Skip to content

Commit ddc6bf9

Browse files
committed
Reject all non-included headers from that are !isCompilingModuleHeader, not just textual module headers. Also remove DirectUses.
1 parent 9eeea3f commit ddc6bf9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module *RootModule) {
187187
continue;
188188

189189
const HeaderFileInfo *HFI = HS.getExistingLocalFileInfo(*File);
190-
if (!HFI || (HFI->isModuleHeader && !HFI->isCompilingModuleHeader) ||
191-
(HFI->isTextualModuleHeader && !PP.alreadyIncluded(*File)))
190+
if (!HFI || (!HFI->isCompilingModuleHeader &&
191+
(HFI->isModuleHeader || !PP.alreadyIncluded(*File))))
192192
continue;
193193

194194
for (const auto &KH : HS.findResolvedModulesForHeader(*File)) {
@@ -238,8 +238,6 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module *RootModule) {
238238
CollectIncludingMapsFromAncestors(CurrentModule);
239239
for (const Module *ImportedModule : CurrentModule->Imports)
240240
CollectIncludingMapsFromAncestors(ImportedModule);
241-
for (const Module *UsedModule : CurrentModule->DirectUses)
242-
CollectIncludingMapsFromAncestors(UsedModule);
243241
for (const Module *UndeclaredModule : CurrentModule->UndeclaredUses)
244242
CollectIncludingMapsFromAncestors(UndeclaredModule);
245243
}
@@ -2061,11 +2059,11 @@ void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS) {
20612059
// changed since it was loaded. Also skip it if it's for a modular header
20622060
// from a different module; in that case, we rely on the module(s)
20632061
// containing the header to provide this information. Also skip it if it's
2064-
// for a textual header from a different module that has not been included;
2065-
// in that case, we don't need the information at all.
2062+
// for any header not from this module that has not been included; in that
2063+
// case, we don't need the information at all.
20662064
const HeaderFileInfo *HFI = HS.getExistingLocalFileInfo(*File);
2067-
if (!HFI || (HFI->isModuleHeader && !HFI->isCompilingModuleHeader) ||
2068-
(HFI->isTextualModuleHeader && !PP->alreadyIncluded(*File)))
2065+
if (!HFI || (!HFI->isCompilingModuleHeader &&
2066+
(HFI->isModuleHeader || !PP->alreadyIncluded(*File))))
20692067
continue;
20702068

20712069
// Massage the file path into an appropriate form.

0 commit comments

Comments
 (0)