summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/TokenLexer.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-07-07 22:38:29 +0000
committerVedant Kumar <vsk@apple.com>2016-07-07 22:38:29 +0000
commit3339c568c43e4644f02289e5edfc78c860f19c9f (patch)
treeae22f8171256a29805780e659cb4f03ad87eb1c8 /clang/lib/Lex/TokenLexer.cpp
parent13dff5784972f542a8ad7ba905db27dcc787c826 (diff)
downloadbcm5719-llvm-3339c568c43e4644f02289e5edfc78c860f19c9f.tar.gz
bcm5719-llvm-3339c568c43e4644f02289e5edfc78c860f19c9f.zip
[Lex] Speed up updateConsecutiveMacroArgTokens (NFC)
SM.isWrittenInSameFile() calls getFileID(), which can be expensive. Move this check behind some cheaper filters. llvm-svn: 274800
Diffstat (limited to 'clang/lib/Lex/TokenLexer.cpp')
-rw-r--r--clang/lib/Lex/TokenLexer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp
index 7f3be700c68..994bae632ae 100644
--- a/clang/lib/Lex/TokenLexer.cpp
+++ b/clang/lib/Lex/TokenLexer.cpp
@@ -787,9 +787,6 @@ static void updateConsecutiveMacroArgTokens(SourceManager &SM,
if (CurLoc.isFileID() != NextLoc.isFileID())
break; // Token from different kind of FileID.
- if (CurLoc.isMacroID() && !SM.isWrittenInSameFile(CurLoc, NextLoc))
- break; // Token from a different macro.
-
int RelOffs;
if (!SM.isInSameSLocAddrSpace(CurLoc, NextLoc, &RelOffs))
break; // Token from different local/loaded location.
@@ -797,6 +794,10 @@ static void updateConsecutiveMacroArgTokens(SourceManager &SM,
// "characters" away.
if (RelOffs < 0 || RelOffs > 50)
break;
+
+ if (CurLoc.isMacroID() && !SM.isWrittenInSameFile(CurLoc, NextLoc))
+ break; // Token from a different macro.
+
CurLoc = NextLoc;
}
OpenPOWER on IntegriCloud