From: Jan Svoboda Date: Mon, 14 Jun 2021 08:32:48 +0000 (+0200) Subject: [clang][deps] NFC: Preserve the original frontend action X-Git-Tag: llvmorg-14-init~4057 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=669771cfe75b48ac4c195ce9e8824319be973f4d;p=platform%2Fupstream%2Fllvm.git [clang][deps] NFC: Preserve the original frontend action 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. override `-emit-pch`. The `-Eonly` flag is not needed - the dependency scanner explicitly sets up its own frontend action anyways. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D103461 --- diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp index 2501ec3..ce8be72 100644 --- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp +++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp @@ -462,6 +462,10 @@ int main(int argc, const char **argv) { std::make_unique( std::move(Compilations)); ResourceDirectoryCache ResourceDirCache; + + // FIXME: Adjust the resulting CompilerInvocation in DependencyScanningAction + // instead of parsing and adjusting the raw command-line. This will make it + // possible to remove some code specific to clang-cl and Windows. AdjustingCompilations->appendArgumentsAdjuster( [&ResourceDirCache](const tooling::CommandLineArguments &Args, StringRef FileName) { @@ -532,7 +536,7 @@ int main(int argc, const char **argv) { #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) { @@ -553,8 +557,6 @@ int main(int argc, const char **argv) { } } AdjustedArgs.push_back("-Xclang"); - AdjustedArgs.push_back("-Eonly"); - AdjustedArgs.push_back("-Xclang"); AdjustedArgs.push_back("-sys-header-deps"); AdjustedArgs.push_back("-Wno-error");