diff options
author | Vedant Kumar <vsk@apple.com> | 2016-07-07 22:38:29 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-07-07 22:38:29 +0000 |
commit | 3339c568c43e4644f02289e5edfc78c860f19c9f (patch) | |
tree | ae22f8171256a29805780e659cb4f03ad87eb1c8 /clang/lib/Lex/TokenLexer.cpp | |
parent | 13dff5784972f542a8ad7ba905db27dcc787c826 (diff) | |
download | bcm5719-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.cpp | 7 |
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; } |