This revision was automatically updated to reflect the committed changes. Closed by commit rG398f25340000: [clang][deps] Include "-cc1" in the arguments (authored by jansvoboda11).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D100942/new/ 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(
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(
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits