[clang] [ASTWriter] Do not allocate source location space for module maps used only for textual headers (PR #116374)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 25 09:17:16 PST 2024


ilya-biryukov wrote:

> Does preprocessing from AST files ([ab75597](https://github.com/llvm/llvm-project/commit/ab75597ddac52f24e9cbd794cded195262ef670e)) with decluse checking ([f3f8461](https://github.com/llvm/llvm-project/commit/f3f846162a5d6b5b84ed7d146a29dc175542c2c0)) still work with this patch? I'm surprised that removing of module maps just because they only provided a textual header doesn't have any consequences in that area.

Sorry for the long reply, I had to dive into the code to understand what this does a little better. I believe the answer is yes, it still works.

The reason behind it is that we still keep those module maps in the `InputFile` structures that we write to the PCMs, we only avoid taking the source location space (i.e. do not write`FileID`) for them.
However, I think we should add another module with a textual header to the test that checks the preprocessing logic as a sanity check and to avoid breaking this in the future. I will do just that in this PR (likely tomorrow)

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


More information about the cfe-commits mailing list