[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

Ian Anderson via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 15:49:44 PDT 2024


ian-twilightcoder wrote:

> > Is this a pre-existing issue, or did my patch change to make "each textual header gets a `HFI`"?
> 
> My best understanding that your patch gave textual headers`HFI`s when the module map was loaded, rather than when the header was included. This shouldn't have mattered, but for the latent pre-existing bug: this caused the modulemap to be "affecting" and thus serialized. (Fixed by this patch)
> 
> Your patch changed an early-bailout condition in `markFileModuleHeader` (1426) from `if !ModularHeader` to `if ExcludedHeader`, so now we carry on further in case of textual headers. The next line calls `getExistingFileInfo` which is probably fine, and then bails out if `ModularHeader` (1430). But with textual headers, we keep going. Finally on line 1433 we call `getFileInfo` and the `HFI` is forced to exist.
> 
> (Having read through this a few times, I really appreciate the detail you put in the comments and commit message, thanks for that!)

Ah yeah, that makes sense. Thanks for the help (and Richard and Jan and Ilya too) in finding and fixing this. HFI's are a lot tricker than they look on the surface!

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


More information about the cfe-commits mailing list