Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions clang/lib/Tooling/DependencyScanningTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,18 @@ buildCC1CommandLine(const driver::Command &Cmd) {
return Out;
}

/// Builds the compilation for the given driver command line and returns the
/// first -cc1 command line, or std::nullopt on error, with diagnostics
/// reported to \c Diags.
static std::optional<std::vector<std::string>> getFirstCC1CommandLine(
ArrayRef<std::string> CommandLine, DiagnosticsEngine &Diags,
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> ScanFS) {
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS) {
// Compilation holds a non-owning a reference to the Driver, hence we need to
// keep the Driver alive when we use Compilation. Arguments to commands may be
// owned by Alloc when expanded from response files.
llvm::BumpPtrAllocator Alloc;
const auto [Driver, Compilation] =
buildCompilation(CommandLine, Diags, ScanFS, Alloc);
buildCompilation(CommandLine, Diags, OverlayFS, Alloc);
if (!Compilation)
return std::nullopt;

Expand Down