[cfe-commits] r59744 - in /cfe/trunk: include/clang/Lex/PTHLexer.h lib/Lex/PTHLexer.cpp

Ted Kremenek kremenek at apple.com
Thu Nov 20 11:49:01 PST 2008


Author: kremenek
Date: Thu Nov 20 13:49:00 2008
New Revision: 59744

URL: http://llvm.org/viewvc/llvm-project?rev=59744&view=rev
Log:
PTHLexer:
- Move PTHLexer::GetToken() to be inside PTHLexer.cpp.
- When lexing in raw mode, null out identifiers.

Modified:
    cfe/trunk/include/clang/Lex/PTHLexer.h
    cfe/trunk/lib/Lex/PTHLexer.cpp

Modified: cfe/trunk/include/clang/Lex/PTHLexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PTHLexer.h?rev=59744&r1=59743&r2=59744&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/PTHLexer.h (original)
+++ cfe/trunk/include/clang/Lex/PTHLexer.h Thu Nov 20 13:49:00 2008
@@ -68,7 +68,7 @@
   
   /// GetToken - Returns the next token.  This method does not advance the
   ///  PTHLexer to the next token.
-  Token GetToken() { return Tokens[CurTokenIdx]; }
+  Token GetToken();
   
   /// AdvanceToken - Advances the PTHLexer to the next token.
   void AdvanceToken() { ++CurTokenIdx; }

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

==============================================================================
--- cfe/trunk/lib/Lex/PTHLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PTHLexer.cpp Thu Nov 20 13:49:00 2008
@@ -27,6 +27,18 @@
   assert(Tokens[LastTokenIdx].is(tok::eof));
 }
 
+Token PTHLexer::GetToken() { 
+  Token Tok = Tokens[CurTokenIdx];
+  
+  // If we are in raw mode, zero out identifier pointers.  This is
+  // needed for 'pragma poison'.  Note that this requires that the Preprocessor
+  // can go back to the original source when it calls getSpelling().
+  if (LexingRawMode && Tok.is(tok::identifier))
+    Tok.setIdentifierInfo(0);
+
+  return Tok;
+}
+
 void PTHLexer::Lex(Token& Tok) {
 LexNextToken:
   if (AtLastToken()) {





More information about the cfe-commits mailing list