[clang] [Modules] No transitive source location change (PR #86912)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 28 19:50:24 PDT 2024


jansvoboda11 wrote:

> Yes, I explained this in Some low level details section. The size of source location won't be affected. Since the size of source location is unsigned (practically, it is 32 bits in most platforms). And we use uint64_t as a unit in the serializer. So there are 32 bit not used completely. The plan is to store the module file index in the higher 32 bits and it shouldn't be a safe problem. Maybe the original wording is not so clear. I've updated it.

Thank you, using 64 bits in the serialization format makes sense! This also means that whenever Clang is configured with 64 bit `SourceLocation`, we should be using 96 bits for serialization: 32 bits for the module file index and 64 bits for the offset itself, correct?

> The only trade-off I saw about this change is that it may increase the size of **on-disk** .pcm files due to we use VBR6 format to decrease the size of small numbers. But on the one side, we still need to pay for more spaces if we want to use `{local-module-index, offset-within-module} pair` (Thanks for the good name suggestion). On the other hand, from the experiment, it shows the overhead is acceptable.

Sorry, I don't quite understand. Are you saying you did or did not try to encode this as two separate 32bit values?

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


More information about the cfe-commits mailing list