@@ -187,8 +187,8 @@ GetAffectingModuleMaps(const Preprocessor &PP, Module *RootModule) {
187
187
continue ;
188
188
189
189
const HeaderFileInfo *HFI = HS.getExistingLocalFileInfo (*File);
190
- if (!HFI || (( HFI->isModuleHeader || HFI->isTextualModuleHeader ) &&
191
- ! HFI->isCompilingModuleHeader ))
190
+ if (!HFI || (HFI->isModuleHeader && ! HFI->isCompilingModuleHeader ) ||
191
+ ( HFI->isTextualModuleHeader && !PP. alreadyIncluded (*File) ))
192
192
continue ;
193
193
194
194
for (const auto &KH : HS.findResolvedModulesForHeader (*File)) {
@@ -2058,12 +2058,14 @@ void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS) {
2058
2058
2059
2059
// Get the file info. Skip emitting this file if we have no information on
2060
2060
// it as a header file (in which case HFI will be null) or if it hasn't
2061
- // changed since it was loaded. Also skip it if it's for a non-excluded
2062
- // header from a different module; in that case, we rely on the module(s)
2063
- // containing the header to provide this information.
2061
+ // changed since it was loaded. Also skip it if it's for a modular header
2062
+ // from a different module; in that case, we rely on the module(s)
2063
+ // 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.
2064
2066
const HeaderFileInfo *HFI = HS.getExistingLocalFileInfo (*File);
2065
- if (!HFI || (( HFI->isModuleHeader || HFI->isTextualModuleHeader ) &&
2066
- !HFI-> isCompilingModuleHeader ))
2067
+ if (!HFI || (HFI->isModuleHeader && ! HFI->isCompilingModuleHeader ) ||
2068
+ (HFI-> isTextualModuleHeader && !PP-> alreadyIncluded (*File) ))
2067
2069
continue ;
2068
2070
2069
2071
// Massage the file path into an appropriate form.
0 commit comments