[PATCH] D100942: [clang][deps] Include "-cc1" in the arguments
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 21 04:33:38 PDT 2021
jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
To simplify tools consuming dependency scanning results, prepend the "-cc1" argument by default.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100942
Files:
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
clang/test/ClangScanDeps/modules-full.cpp
Index: clang/test/ClangScanDeps/modules-full.cpp
===================================================================
--- clang/test/ClangScanDeps/modules-full.cpp
+++ 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: ],
Index: clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -43,18 +43,13 @@
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(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100942.339182.patch
Type: text/x-patch
Size: 2371 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210421/e22993d0/attachment.bin>
More information about the cfe-commits
mailing list