diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-23 21:02:30 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-23 21:02:30 +0000 |
commit | f8c50652f7b224e66b0b6098d1fba07e036019b4 (patch) | |
tree | fbdedd70218bad76a76936359d6882e6dea958ff /lib/Lex/Lexer.cpp | |
parent | 984e42ca1ff7775ce39372c314f1cb7d6862c4c7 (diff) |
In Lexer::isAtEndOfMacroExpansion use SourceManager::isInFileID and avoid
the extra SourceManager::getFileID call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138376 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 25f07c9e4f..d8ebc9ffe6 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -755,14 +755,12 @@ bool Lexer::isAtEndOfMacroExpansion(SourceLocation loc, FileID FID = SM.getFileID(loc); SourceLocation afterLoc = loc.getFileLocWithOffset(tokLen+1); - if (!SM.isBeforeInSourceLocationOffset(afterLoc, SM.getNextLocalOffset())) - return true; // We got past the last FileID, this points to the last token. + if (SM.isInFileID(afterLoc, FID)) + return false; // Still in the same FileID, does not point to the last token. // FIXME: If the token comes from the macro token paste operator ('##') // or the stringify operator ('#') this function will always return false; - if (FID == SM.getFileID(afterLoc)) - return false; // Still in the same FileID, does not point to the last token. - + SourceLocation expansionLoc = SM.getSLocEntry(FID).getExpansion().getExpansionLocEnd(); if (expansionLoc.isFileID()) |