[clang] 7b8cf98 - Reland "[clang][SourceManager] cache Macro Expansions""
Nick Desaulniers via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 29 12:54:47 PDT 2020
Author: Nick Desaulniers
Date: 2020-06-29T12:54:32-07:00
New Revision: 7b8cf98b4a9a2f5ea3667fdbf913a4f8952ed36a
URL: https://github.com/llvm/llvm-project/commit/7b8cf98b4a9a2f5ea3667fdbf913a4f8952ed36a
DIFF: https://github.com/llvm/llvm-project/commit/7b8cf98b4a9a2f5ea3667fdbf913a4f8952ed36a.diff
LOG: Reland "[clang][SourceManager] cache Macro Expansions""
This reverts commit 33d63f02ce408d181e13089ee5a667fb2e1cdc78.
Differential Revision: https://reviews.llvm.org/D80681
Added:
Modified:
clang/lib/Basic/SourceManager.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 425bef717574..0a76c78cd44f 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -861,11 +861,8 @@ FileID SourceManager::getFileIDLocal(unsigned SLocOffset) const {
--I;
if (I->getOffset() <= SLocOffset) {
FileID Res = FileID::get(int(I - LocalSLocEntryTable.begin()));
-
- // If this isn't an expansion, remember it. We have good locality across
- // FileID lookups.
- if (!I->isExpansion())
- LastFileIDLookup = Res;
+ // Remember it. We have good locality across FileID lookups.
+ LastFileIDLookup = Res;
NumLinearScans += NumProbes+1;
return Res;
}
@@ -899,10 +896,8 @@ FileID SourceManager::getFileIDLocal(unsigned SLocOffset) const {
SLocOffset < getLocalSLocEntry(MiddleIndex + 1).getOffset()) {
FileID Res = FileID::get(MiddleIndex);
- // If this isn't a macro expansion, remember it. We have good locality
- // across FileID lookups.
- if (!LocalSLocEntryTable[MiddleIndex].isExpansion())
- LastFileIDLookup = Res;
+ // Remember it. We have good locality across FileID lookups.
+ LastFileIDLookup = Res;
NumBinaryProbes += NumProbes;
return Res;
}
@@ -940,9 +935,7 @@ FileID SourceManager::getFileIDLoaded(unsigned SLocOffset) const {
const SrcMgr::SLocEntry &E = getLoadedSLocEntry(I);
if (E.getOffset() <= SLocOffset) {
FileID Res = FileID::get(-int(I) - 2);
-
- if (!E.isExpansion())
- LastFileIDLookup = Res;
+ LastFileIDLookup = Res;
NumLinearScans += NumProbes + 1;
return Res;
}
@@ -975,8 +968,7 @@ FileID SourceManager::getFileIDLoaded(unsigned SLocOffset) const {
if (isOffsetInFileID(FileID::get(-int(MiddleIndex) - 2), SLocOffset)) {
FileID Res = FileID::get(-int(MiddleIndex) - 2);
- if (!E.isExpansion())
- LastFileIDLookup = Res;
+ LastFileIDLookup = Res;
NumBinaryProbes += NumProbes;
return Res;
}
More information about the cfe-commits
mailing list