================ @@ -701,6 +701,10 @@ class SourceManager : public RefCountedBase<SourceManager> { /// use (-ID - 2). SmallVector<SrcMgr::SLocEntry, 0> LoadedSLocEntryTable; + /// For each allocation in LoadedSLocEntryTable, we keep the new size. This + /// can be used to determine whether two FileIDs come from the same AST file. + SmallVector<size_t, 0> LoadedSLocEntryTableSegments; ---------------- benlangmuir wrote:
I feel like this could use more explanation. IIUC what you're ultimately checking is whether two FileIDs were allocated in the same call to `AllocateLoadedSLocEntries`, and relying on ASTReader to make a single call to that function for each AST file. Is there a reason you're storing the size (ie translating to 0-based) instead of storing the actual boundary FileID and doing the search based on that? I feel like searching for -ID - 2 is pretty non-obvious. https://github.com/llvm/llvm-project/pull/66962 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits