================
@@ -161,8 +161,13 @@ static TypeCode getTypeCodeForTypeClass(Type::TypeClass 
id) {
 
 namespace {
 
-std::set<const FileEntry *> GetAffectingModuleMaps(const Preprocessor &PP,
-                                                   Module *RootModule) {
+std::optional<std::set<const FileEntry *>>
+GetAffectingModuleMaps(const Preprocessor &PP, Module *RootModule) {
+  // Without implicit module map search, there's no good reason to know about
+  // any module maps that are not affecting.
+  if (!PP.getHeaderSearchInfo().getHeaderSearchOpts().ImplicitModuleMaps)
+    return std::nullopt;
----------------
zygoloid wrote:

Yes, that sounds great, thank you. In our case, it's not that the module map 
files are unused, it's that we specify the same `-fmodule-map-file=` flag to 
all of our compilations, and so we *usually* get the information from a `.pcm` 
file rather than from the module map file, and it turns out that pruning out 
the repeated module maps make a rather large difference to our source location 
address space usage :)

All that said, we have some other ideas for how to address the problems we're 
seeing with source location address space usage. Maybe we can get to a point 
where we're not relying on this at all -- I think this patch is probably the 
right behavior, even though I think it's contributing to a regression for us, 
so I think this new behavior should be the default, and we can clean up the 
flag once we don't need it any more.

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

Reply via email to