[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 08:02:56 PDT 2024


================
@@ -187,7 +187,8 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module *RootModule) {
       continue;
 
     const HeaderFileInfo *HFI = HS.getExistingLocalFileInfo(*File);
-    if (!HFI || (HFI->isModuleHeader && !HFI->isCompilingModuleHeader))
+    if (!HFI || (HFI->isModuleHeader && !HFI->isCompilingModuleHeader) ||
+        (HFI->isTextualModuleHeader && !PP.alreadyIncluded(*File)))
----------------
jansvoboda11 wrote:

I'm not happy with allowing the textual headers through here, since that puts the containing module to `ModulesToProcess`, for which we then check the imports, uses and undeclared uses. I don't think that's necessary.

We should probably track the module that covers the textual header we included in similar way to the other modules I listed (e.g. `llvm::SmallSetVector<Module *, 2> Module::TextualIncludes`, or just stash them into `Module::AffectingClangModules` and include those in affecting module map computation.

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


More information about the cfe-commits mailing list