[cfe-commits] r138376 - /cfe/trunk/lib/Lex/Lexer.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Aug 23 14:02:30 PDT 2011


Author: akirtzidis
Date: Tue Aug 23 16:02:30 2011
New Revision: 138376

URL: http://llvm.org/viewvc/llvm-project?rev=138376&view=rev
Log:
In Lexer::isAtEndOfMacroExpansion use SourceManager::isInFileID and avoid
the extra SourceManager::getFileID call.

Modified:
    cfe/trunk/lib/Lex/Lexer.cpp

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=138376&r1=138375&r2=138376&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Tue Aug 23 16:02:30 2011
@@ -755,14 +755,12 @@
 
   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())





More information about the cfe-commits mailing list