[cfe-commits] r62420 - /cfe/trunk/lib/Lex/Preprocessor.cpp

Chris Lattner sabre at nondot.org
Fri Jan 16 23:57:25 PST 2009


Author: lattner
Date: Sat Jan 17 01:57:25 2009
New Revision: 62420

URL: http://llvm.org/viewvc/llvm-project?rev=62420&view=rev
Log:
in Preprocessor::AdvanceToTokenCharacter, don't actually bother
creating a whole lexer when we just want one static method.

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

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=62420&r1=62419&r2=62420&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Sat Jan 17 01:57:25 2009
@@ -320,18 +320,16 @@
   while (CharNo && Lexer::isObviouslySimpleCharacter(*TokPtr))
     ++TokPtr, --CharNo, ++PhysOffset;
   
-  // If we have a character that may be a trigraph or escaped newline, create a
+  // If we have a character that may be a trigraph or escaped newline, use a
   // lexer to parse it correctly.
   if (CharNo != 0) {
-    // Create a lexer starting at this token position.
-    Lexer TheLexer(TokStart, *this, TokPtr);
-    Token Tok;
     // Skip over characters the remaining characters.
-    const char *TokStartPtr = TokPtr;
-    for (; CharNo; --CharNo)
-      TheLexer.getAndAdvanceChar(TokPtr, Tok);
-    
-    PhysOffset += TokPtr-TokStartPtr;
+    for (; CharNo; --CharNo) {
+      unsigned Size;
+      Lexer::getCharAndSizeNoWarn(TokPtr, Size, Features);
+      TokPtr += Size;
+      PhysOffset += Size;
+    }
   }
   
   return TokStart.getFileLocWithOffset(PhysOffset);





More information about the cfe-commits mailing list