[PATCH] D103461: [clang][deps] NFC: Do not adjust the original action

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 1 07:19:03 PDT 2021


jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith, arphaman.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch stops adjusting the frontend action when `clang-scan-deps` is configured to use the full output format.

In a future patch, the dependency scanner needs to check whether the original compiler invocation builds a PCH. That's impossible when `-Eonly` et al. overrides `-emit-pch`.

The `-Eonly` flag is not needed - the dependency scanner explicitly sets up its own frontend action.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103461

Files:
  clang/tools/clang-scan-deps/ClangScanDeps.cpp


Index: clang/tools/clang-scan-deps/ClangScanDeps.cpp
===================================================================
--- clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -439,6 +439,8 @@
       std::make_unique<tooling::ArgumentsAdjustingCompilations>(
           std::move(Compilations));
   ResourceDirectoryCache ResourceDirCache;
+  // FIXME: Adjust the resulting CompilerInvocation in DependencyScanningAction
+  //  instead of parsing and adjusting the raw command-line.
   AdjustingCompilations->appendArgumentsAdjuster(
       [&ResourceDirCache](const tooling::CommandLineArguments &Args,
                           StringRef FileName) {
@@ -509,7 +511,7 @@
 #else
         AdjustedArgs.push_back("/dev/null");
 #endif
-        if (!HasMT && !HasMQ) {
+        if (!HasMT && !HasMQ && Format == ScanningOutputFormat::Make) {
           // We're interested in source dependencies of an object file.
           std::string FileNameArg;
           if (!HasMD) {
@@ -530,8 +532,6 @@
           }
         }
         AdjustedArgs.push_back("-Xclang");
-        AdjustedArgs.push_back("-Eonly");
-        AdjustedArgs.push_back("-Xclang");
         AdjustedArgs.push_back("-sys-header-deps");
         AdjustedArgs.push_back("-Wno-error");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103461.348970.patch
Type: text/x-patch
Size: 1299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210601/a82b06cf/attachment.bin>


More information about the cfe-commits mailing list