Skip to content
Snippets Groups Projects
Commit 0bc99373 authored by Vedant Kumar's avatar Vedant Kumar
Browse files

[Lex] Speed up updateConsecutiveMacroArgTokens (NFC)

SM.isWrittenInSameFile() calls getFileID(), which can be expensive.
Move this check behind some cheaper filters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274800 91177308-0d34-0410-b5e6-96231b3b80d8
parent d44cc293
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment