aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2024-04-19 12:45:40 -0700
committerGitHub <noreply@github.com>2024-04-19 12:45:40 -0700
commit3ea5dff0efdbb4bf5590d882810aa42f9ec26e4e (patch)
treee9d8063616e5818bb9e5ddad78122070fa9ccc8f /clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
parent8e2060bf210e83d6cc34f61185918ca67b54f6f1 (diff)
downloadllvm-3ea5dff0efdbb4bf5590d882810aa42f9ec26e4e.zip
llvm-3ea5dff0efdbb4bf5590d882810aa42f9ec26e4e.tar.gz
llvm-3ea5dff0efdbb4bf5590d882810aa42f9ec26e4e.tar.bz2
[clang][modules] Only avoid pruning module maps when asked to (#89428)
Pruning non-affecting module maps is useful even when passing module maps explicitly via `-fmodule-map-file=<path>`. For this situation, this patch reinstates the behavior we had prior to #87849. For the situation where the explicit module map file arguments were generated by the dependency scanner (which already pruned the non-affecting ones), this patch introduces new `-cc1` flag `-fno-modules-prune-non-affecting-module-map-files` that avoids the extra work.
Diffstat (limited to 'clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp')
-rw-r--r--clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index e19f19b2..f46324e 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -179,6 +179,11 @@ makeCommonInvocationForModuleBuild(CompilerInvocation CI) {
CI.resetNonModularOptions();
CI.clearImplicitModuleBuildOptions();
+ // The scanner takes care to avoid passing non-affecting module maps to the
+ // explicit compiles. No need to do extra work just to find out there are no
+ // module map files to prune.
+ CI.getHeaderSearchOpts().ModulesPruneNonAffectingModuleMaps = false;
+
// Remove options incompatible with explicit module build or are likely to
// differ between identical modules discovered from different translation
// units.