[cfe-commits] r38555 - /cfe/cfe/trunk/Lex/Lexer.cpp

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:22:34 PDT 2007


Author: sabre
Date: Wed Jul 11 11:22:34 2007
New Revision: 38555

URL: http://llvm.org/viewvc/llvm-project?rev=38555&view=rev
Log:
Simplify some code

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

Modified: cfe/cfe/trunk/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Lexer.cpp?rev=38555&r1=38554&r2=38555&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/Lexer.cpp (original)
+++ cfe/cfe/trunk/Lex/Lexer.cpp Wed Jul 11 11:22:34 2007
@@ -341,21 +341,20 @@
     Result.SetKind(tok::identifier);
     
     // Look up this token, see if it is a macro, or if it is a language keyword.
-    const char *SpelledTokStart, *SpelledTokEnd;
+    IdentifierTokenInfo *II;
     if (!Result.needsCleaning()) {
       // No cleaning needed, just use the characters from the lexed buffer.
-      SpelledTokStart = IdStart;
-      SpelledTokEnd   = IdEnd;
+      II = PP.getIdentifierInfo(IdStart, IdEnd);
     } else {
       // Cleaning needed, alloca a buffer, clean into it, then use the buffer.
       char *TmpBuf = (char*)alloca(Result.getLength());
       unsigned Size = PP.getSpelling(Result, TmpBuf);
-      SpelledTokStart = TmpBuf;
-      SpelledTokEnd = TmpBuf+Size;
+      II = PP.getIdentifierInfo(TmpBuf, TmpBuf+Size);
     }
+    Result.SetIdentifierInfo(II);
     
-    Result.SetIdentifierInfo(PP.getIdentifierInfo(SpelledTokStart,
-                                                  SpelledTokEnd));
+    // Finally, now that we know we have an identifier, pass this off to the
+    // preprocessor, which may macro expand it or something.
     return PP.HandleIdentifier(Result);
   }
   





More information about the cfe-commits mailing list