[clang] [clang][modules] Only compute affecting module maps with implicit search (PR #87849)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 16 16:16:39 PDT 2024


================
@@ -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:

Hm, I see that adding this check was the whole point of the patch. I don't think this works -- it's not feasible for the build system to know whether a module map file would affect a compilation or not.

https://github.com/llvm/llvm-project/pull/87849


More information about the cfe-commits mailing list