mirror of
https://github.com/intel/llvm.git
synced 2026-02-04 03:26:06 +08:00
[Lex] Speed up updateConsecutiveMacroArgTokens (NFC)
SM.isWrittenInSameFile() calls getFileID(), which can be expensive. Move this check behind some cheaper filters. llvm-svn: 274800
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user