================ @@ -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() ---------------- hokein wrote:
This case can happen — if the initial value of `GreaterIndex` is `LocalSLocEntryTable.size()`, then after `--GreaterIndex`, it points to the last valid element (size() - 1), which is fine. However, we will access `GreaterIndex + 1`, that would be out of bounds. https://github.com/llvm/llvm-project/pull/146782 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits