Skip to content

Commit 7fea83e

Browse files
committed
[clang] NFC, use LocalLocOffsetTable in getFIleIDLocal.
1 parent 784bd61 commit 7fea83e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

clang/lib/Basic/SourceManager.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
832832
// SLocOffset.
833833
unsigned LessIndex = 0;
834834
// upper bound of the search range.
835-
unsigned GreaterIndex = LocalSLocEntryTable.size();
835+
unsigned GreaterIndex = LocalLocOffsetTable.size();
836836
// Use the LastFileIDLookup to prune the search space.
837837
if (LastLookupStartOffset < SLocOffset)
838838
LessIndex = LastFileIDLookup.ID;
@@ -848,11 +848,11 @@ FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
848848
FileID Res = FileID::get(int(GreaterIndex));
849849
// Remember it. We have good locality across FileID lookups.
850850
LastFileIDLookup = Res;
851-
LastLookupStartOffset = LocalSLocEntryTable[GreaterIndex].getOffset();
851+
LastLookupStartOffset = LocalLocOffsetTable[GreaterIndex];
852852
LastLookupEndOffset =
853-
GreaterIndex + 1 >= LocalSLocEntryTable.size()
853+
GreaterIndex + 1 >= LocalLocOffsetTable.size()
854854
? NextLocalOffset
855-
: LocalSLocEntryTable[GreaterIndex + 1].getOffset();
855+
: LocalLocOffsetTable[GreaterIndex + 1];
856856
NumLinearScans += NumProbes + 1;
857857
return Res;
858858
}
@@ -873,8 +873,8 @@ FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const {
873873
// At this point, LessIndex is the index of the *first element greater than*
874874
// SLocOffset. The element we are actually looking for is the one immediately
875875
// before it.
876-
LastLookupStartOffset = LocalSLocEntryTable[LessIndex - 1].getOffset();
877-
LastLookupEndOffset = LocalSLocEntryTable[LessIndex].getOffset();
876+
LastLookupStartOffset = LocalLocOffsetTable[LessIndex - 1];
877+
LastLookupEndOffset = LocalLocOffsetTable[LessIndex];
878878
return LastFileIDLookup = FileID::get(LessIndex - 1);
879879
}
880880

0 commit comments

Comments
 (0)