[clang] [clang] SourceManager: Cache offsets for LastFileIDLookup to speed up getFileID (PR #146782)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 3 06:20:02 PDT 2025
================
@@ -849,7 +850,12 @@ FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
FileID Res = FileID::get(int(GreaterIndex));
// Remember it. We have good locality across FileID lookups.
LastFileIDLookup = Res;
- NumLinearScans += NumProbes+1;
+ LastLookupStartOffset = LocalSLocEntryTable[GreaterIndex].getOffset();
+ LastLookupEndOffset =
+ GreaterIndex + 1 >= LocalSLocEntryTable.size()
----------------
erichkeane wrote:
Got it, thanks!
https://github.com/llvm/llvm-project/pull/146782
More information about the cfe-commits
mailing list