[clang] [clang][modules] HeaderSearch::MarkFileModuleHeader creates extra HeaderFileInfo, breaks PCM reuse (PR #89005)

Ian Anderson via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 17 15:27:55 PDT 2024


================
@@ -1313,6 +1313,14 @@ OptionalFileEntryRef HeaderSearch::LookupSubframeworkHeader(
 // File Info Management.
 //===----------------------------------------------------------------------===//
 
+static bool
+headerFileInfoModuleBitsMatchRole(const HeaderFileInfo *HFI,
+                                  ModuleMap::ModuleHeaderRole Role) {
+  return (HFI->isModuleHeader == ModuleMap::isModular(Role)) &&
+         (HFI->isTextualModuleHeader ==
+          ((Role & ModuleMap::TextualHeader) != 0));
----------------
ian-twilightcoder wrote:

I don't think I quite understand. I think the test looked something like this.
```
module A [no_undeclared_includes] {
  module one { header "one.h" }
  module two { header "two" }
}
module B {
  module one { textual header "one.h" }
  module three { header "three.h" }
}
```
That allows one.h to include three.h even though A doesn't have a `use B`. But wouldn't the better setup be to have the `use B`? I might not be quite understanding what you're saying.

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


More information about the cfe-commits mailing list