[clang] [clang][modules] Headers meant to be included multiple times can be completely invisible in clang module builds (PR #83660)
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 16 16:11:20 PDT 2024
================
@@ -1403,94 +1421,146 @@ bool HeaderSearch::isFileMultipleIncludeGuarded(FileEntryRef File) const {
void HeaderSearch::MarkFileModuleHeader(FileEntryRef FE,
ModuleMap::ModuleHeaderRole Role,
bool isCompilingModuleHeader) {
- bool isModularHeader = ModuleMap::isModular(Role);
-
// Don't mark the file info as non-external if there's nothing to change.
if (!isCompilingModuleHeader) {
- if (!isModularHeader)
+ if ((Role & ModuleMap::ExcludedHeader))
return;
auto *HFI = getExistingFileInfo(FE);
if (HFI && HFI->isModuleHeader)
return;
}
auto &HFI = getFileInfo(FE);
- HFI.isModuleHeader |= isModularHeader;
+ HFI.mergeModuleMembership(Role);
HFI.isCompilingModuleHeader |= isCompilingModuleHeader;
----------------
zygoloid wrote:
It looks to me like we're now calling `getFileInfo(FE)` even in cases where the info doesn't change, for a textual header. I think that's what's causing the regression we're seeing -- we're now considering a repeatedly-used module map file to be affecting, even though it isn't, because we end up with a local `HeaderFileInfo` instead of an imported one.
https://github.com/llvm/llvm-project/pull/83660
More information about the cfe-commits
mailing list