================
@@ -2057,9 +2065,12 @@ void ASTWriter::WriteHeaderSearch(const HeaderSearch
&HS) {
// it as a header file (in which case HFI will be null) or if it hasn't
// changed since it was loaded. Also skip it if it's for a modular header
// from a different module; in that case, we rely on the module(s)
- // containing the header to provide this information.
+ // containing the header to provide this information. Also skip it if it's
+ // for any header not from this module that has not been included; in that
+ // case, we don't need the information at all.
const HeaderFileInfo *HFI = HS.getExistingLocalFileInfo(*File);
- if (!HFI || (HFI->isModuleHeader && !HFI->isCompilingModuleHeader))
+ if (!HFI || (!HFI->isCompilingModuleHeader &&
----------------
sam-mccall wrote:
nit: this seems hard to follow, consider splitting up as:
```
if (!HFI)
continue; // we're not relying on this file at all
if (HFI->isModuleHeader && !HFI->isCompilingModuleHeader)
continue; // will import HFI from its module
if (!HFI->isCompilingModuleHeader && !PP->alreadyIncluded(*File))
continue; // unused header needs no description
```
and possibly pulling out as `static shouldDescribeHeader(HFI)` or so?
https://github.com/llvm/llvm-project/pull/89441
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits