[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 26 15:13:53 PDT 2024


================
@@ -249,9 +245,27 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module *RootModule) {
 
     for (const auto &KH : HS.findResolvedModulesForHeader(*File))
       if (const Module *M = KH.getModule())
-        CollectIncludingMapsFromAncestors(M);
+        CollectModuleMapsForHierarchy(M);
   }
 
+  // FIXME: This algorithm is not correct for module map hierarchies where
----------------
benlangmuir wrote:

> Now, we will only walk the module hierarchy and only mark the defining MSub2.modulemap and M.modulemap as affecting, effectively creating a "hole" in the tree of module map file includes by omitting MSub1.modulemap.

Does this cause a failure when it tries to include MSub1.modulemap? In some sense this scenario could be "fine" since you have all the modulemaps that contributed to the module definition.

> However, cases like the following were broken before and will remain broken with this patch:

Would being lazier about the module definitions solve this?

I'm not clear what the path to actually fixing these looks like

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


More information about the cfe-commits mailing list