[PATCH] D89749: SourceManager: Don't allocate an SLocEntry until it's loaded
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 26 16:39:50 PDT 2020
dexonsmith added a comment.
In D89749#2354386 <https://reviews.llvm.org/D89749#2354386>, @dexonsmith wrote:
> That means it's not safe to store an address from `getSLocEntry` when there will be another call. I can update `ASTImporter` to use a copy, but I think this is too much of a gotcha... I'll think more about what to do, but here are the ideas I have:
>
> 1. Return an `SLocEntry` by-value. After https://reviews.llvm.org/D89580 that's just 24B (down from 40B), so maybe this is reasonable.
> 2. Return an `SLocEntryRef` by-value, a new type that is (say) a pointer to the correct `SLocEntryTable` and an index into it. This would be 16B.
>
> Let me know if you have thoughts.
3. Use indirection (like https://github.com/Teemperor/llvm/commit/a06b21cbc55c6d2f1d2bf6f39771411ccc17342b, but doesn't have to be lazy) to allocate `SLocEntry`s in non-contiguous chunks, with stable addresses.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89749/new/
https://reviews.llvm.org/D89749
More information about the cfe-commits
mailing list