[clang] [clang][modules] Headers meant to be included multiple times can be completely invisible in clang module builds (PR #83660)

Ian Anderson via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 10 10:07:46 PDT 2024


ian-twilightcoder wrote:

> @ian-twilightcoder this change seemed to cause our internal builds to run out of source location space.
> 
> ```
> remark: source manager location address space usage: [-Rsloc-usage]
> note: 408559B in local locations, 2146921126B in locations loaded from AST files, for a total of 2147329685B (99% of available space)
> ```
> 
> The main offenders from the follow-ups are:
> 
> * module map files for standard library and C/C++ runtime headers, each entered a few thousand times,
> * various headers without header guards, e.g. libc++'s `__config` and others,
> * `arm_neon.h`.
>   Without looking deeper into what the change does, this might be an expected outcome here. However, let me know if something already looks off from this small description (e.g. the module maps entered so many times is surprising, I'll need to see if this happened before).
> 
> I will investigate this further, but we might not be able to change how our builds work quickly. Would it be ok to revert this change or put the new behavior under a flag to give us some more time to investigate?

That's surprising, the code to re-enter files is `HeaderSearch::ShouldEnterIncludeFile`, and I only changed the behavior there for `#import`. The `#include` behavior is still governed by `#pragma once` and `FileInfo.getControllingMacro`, and that isn't changed. Are you sure it's this change? Do you have a repro case?

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


More information about the cfe-commits mailing list