Author: Haojian Wu Date: 2025-07-07T09:57:41+02:00 New Revision: 7fea83e3143e1a88a096a37ecd13668e2da94b93
URL: https://github.com/llvm/llvm-project/commit/7fea83e3143e1a88a096a37ecd13668e2da94b93 DIFF: https://github.com/llvm/llvm-project/commit/7fea83e3143e1a88a096a37ecd13668e2da94b93.diff LOG: [clang] NFC, use LocalLocOffsetTable in getFIleIDLocal. Added: Modified: clang/lib/Basic/SourceManager.cpp Removed: ################################################################################ diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 79a0d9d28c40b..8ee2202e48618 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -832,7 +832,7 @@ FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const { // SLocOffset. unsigned LessIndex = 0; // upper bound of the search range. - unsigned GreaterIndex = LocalSLocEntryTable.size(); + unsigned GreaterIndex = LocalLocOffsetTable.size(); // Use the LastFileIDLookup to prune the search space. if (LastLookupStartOffset < SLocOffset) LessIndex = LastFileIDLookup.ID; @@ -848,11 +848,11 @@ FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const { FileID Res = FileID::get(int(GreaterIndex)); // Remember it. We have good locality across FileID lookups. LastFileIDLookup = Res; - LastLookupStartOffset = LocalSLocEntryTable[GreaterIndex].getOffset(); + LastLookupStartOffset = LocalLocOffsetTable[GreaterIndex]; LastLookupEndOffset = - GreaterIndex + 1 >= LocalSLocEntryTable.size() + GreaterIndex + 1 >= LocalLocOffsetTable.size() ? NextLocalOffset - : LocalSLocEntryTable[GreaterIndex + 1].getOffset(); + : LocalLocOffsetTable[GreaterIndex + 1]; NumLinearScans += NumProbes + 1; return Res; } @@ -873,8 +873,8 @@ FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const { // At this point, LessIndex is the index of the *first element greater than* // SLocOffset. The element we are actually looking for is the one immediately // before it. - LastLookupStartOffset = LocalSLocEntryTable[LessIndex - 1].getOffset(); - LastLookupEndOffset = LocalSLocEntryTable[LessIndex].getOffset(); + LastLookupStartOffset = LocalLocOffsetTable[LessIndex - 1]; + LastLookupEndOffset = LocalLocOffsetTable[LessIndex]; return LastFileIDLookup = FileID::get(LessIndex - 1); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits