[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 13:35:53 PDT 2024


================
@@ -0,0 +1,20 @@
+// This test checks that a module map with a textual header can be marked as
----------------
jansvoboda11 wrote:

This patch unfortunately doesn't pass that test (on line 44) due to [this](https://github.com/llvm/llvm-project/pull/89441/files#r1576422103): when computing affecting module maps for B, "A.h" makes it through the `HFI` filter, module A is added to `ModulesToProcess` and the module map for its import X is considered affecting.

I tried splitting up that logic so that we consider imports and undeclared uses only of the current module and its submodules. That doesn't work either, because `PP.alreadyIncluded("X.h")` returns `true`, since it checks the global (cross-module) state, not the local state. This might be possible with #71117. Until then, I think we need some "has this been included locally" state that's local to the current TU. Maybe that can live in `HeaderFileInfo` as per your patch, or as a `Preprocessor` state.

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


More information about the cfe-commits mailing list