diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2021-04-21 13:25:31 +0200 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2021-04-22 10:57:56 +0200 |
commit | 398f25340000f26d648ebbc7eae9dc401ffc7d5f (patch) | |
tree | d30494277fd9c708bce5a88bf504090020c0a19a | |
parent | [mlir][linalg] remove interchange option on linalg to loop lowering. (diff) | |
download | llvm-project-398f25340000f26d648ebbc7eae9dc401ffc7d5f.tar.gz llvm-project-398f25340000f26d648ebbc7eae9dc401ffc7d5f.tar.bz2 llvm-project-398f25340000f26d648ebbc7eae9dc401ffc7d5f.zip |
[clang][deps] Include "-cc1" in the arguments
To simplify tools consuming dependency scanning results, prepend the "-cc1" argument by default.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D100942
-rw-r--r-- | clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | 11 | ||||
-rw-r--r-- | clang/test/ClangScanDeps/modules-full.cpp | 3 |
2 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp index 68a03291e7bb..a1e54532f3e6 100644 --- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp +++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp @@ -43,18 +43,13 @@ serializeCompilerInvocation(CompilerInvocation &CI) { llvm::BumpPtrAllocator Alloc; llvm::StringSaver Strings(Alloc); auto SA = [&Strings](const Twine &Arg) { return Strings.save(Arg).data(); }; - SmallVector<const char *, 32> Args; - // Synthesize full command line from the CompilerInvocation. + // Synthesize full command line from the CompilerInvocation, including "-cc1". + SmallVector<const char *, 32> Args{"-cc1"}; CI.generateCC1CommandLine(Args, SA); // Convert arguments to the return type. - std::vector<std::string> Ret; - Ret.reserve(Args.size()); - for (const char *Arg : Args) - Ret.emplace_back(Arg); - - return Ret; + return std::vector<std::string>{Args.begin(), Args.end()}; } std::vector<std::string> ModuleDeps::getFullCommandLine( diff --git a/clang/test/ClangScanDeps/modules-full.cpp b/clang/test/ClangScanDeps/modules-full.cpp index 4337ae9642a5..5c3e53610e5a 100644 --- a/clang/test/ClangScanDeps/modules-full.cpp +++ b/clang/test/ClangScanDeps/modules-full.cpp @@ -37,6 +37,7 @@ // CHECK-NEXT: ], // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Inputs/module.modulemap", // CHECK-NEXT: "command-line": [ +// CHECK-NEXT: "-cc1", // CHECK: "-fmodule-map-file=[[PREFIX]]/Inputs/module.modulemap", // CHECK: "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[CONTEXT_HASH_H1]]/header2-{{[A-Z0-9]+}}.pcm", // CHECK-NOT: "-fimplicit-module-maps", @@ -53,6 +54,7 @@ // CHECK-NEXT: "clang-module-deps": [], // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Inputs/module.modulemap", // CHECK-NEXT: "command-line": [ +// CHECK-NEXT: "-cc1", // CHECK-NOT: "-fimplicit-module-maps", // CHECK: "-fno-implicit-modules", // CHECK: ], @@ -67,6 +69,7 @@ // CHECK-NEXT: "clang-module-deps": [], // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Inputs/module.modulemap", // CHECK-NEXT: "command-line": [ +// CHECK-NEXT: "-cc1", // CHECK-NOT: "-fimplicit-module-maps", // CHECK: "-fno-implicit-modules", // CHECK: ], |