llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Alexandre Ganea (aganea)

<details>
<summary>Changes</summary>

Previously, since response (.rsp) files weren't expanded at the very beginning 
of clang-scan-deps, we only parsed the command-line as provided in the Clang 
.cdb file. Unfortunately, when using Unreal Engine, arguments are always 
generated in a .rsp file (ie. `/path/to/clang-cl.exe 
@/path/to/filename_args.rsp`).

After this patch, `/Fo` can be parsed and added to the final command-line. 
Without this option, the make targets that are emitted are made up from the 
input file name alone. We have some cases where the same input in the project 
generates several output files, so we end up with duplicate make targets in the 
scan-deps emitted dependency file.

---
Full diff: https://github.com/llvm/llvm-project/pull/89950.diff


1 Files Affected:

- (modified) clang/tools/clang-scan-deps/ClangScanDeps.cpp (+6-1) 


``````````diff
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp 
b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index f42af7e330e17a..7b7f10c4be7421 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -792,10 +792,15 @@ int clang_scan_deps_main(int argc, char **argv, const 
llvm::ToolContext &) {
 
   llvm::cl::PrintOptionValues();
 
+  // Expand response files in advance, so that we can "see" all the arguments
+  // when adjusting below.
+  auto ResponseExpander = expandResponseFiles(std::move(Compilations),
+                                              llvm::vfs::getRealFileSystem());
+
   // The command options are rewritten to run Clang in preprocessor only mode.
   auto AdjustingCompilations =
       std::make_unique<tooling::ArgumentsAdjustingCompilations>(
-          std::move(Compilations));
+          std::move(ResponseExpander));
   ResourceDirectoryCache ResourceDirCache;
 
   AdjustingCompilations->appendArgumentsAdjuster(

``````````

</details>


https://github.com/llvm/llvm-project/pull/89950
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to