[cfe-commits] r64250 - /cfe/trunk/Driver/CacheTokens.cpp

Ted Kremenek kremenek at apple.com
Tue Feb 10 14:43:16 PST 2009


Author: kremenek
Date: Tue Feb 10 16:43:16 2009
New Revision: 64250

URL: http://llvm.org/viewvc/llvm-project?rev=64250&view=rev
Log:
PTH generation: Discard tokens that appear after and on the same line as '#endif'.

Modified:
    cfe/trunk/Driver/CacheTokens.cpp

Modified: cfe/trunk/Driver/CacheTokens.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/CacheTokens.cpp?rev=64250&r1=64249&r2=64250&view=diff

==============================================================================
--- cfe/trunk/Driver/CacheTokens.cpp (original)
+++ cfe/trunk/Driver/CacheTokens.cpp Tue Feb 10 16:43:16 2009
@@ -427,7 +427,8 @@
   
   do {
     L.LexFromRawLexer(Tok);
-    
+  NextToken:
+
     if ((Tok.isAtStartOfLine() || Tok.is(tok::eof)) &&
         ParsingPreprocessorDirective) {
       // Insert an eom token into the token cache.  It has the same
@@ -513,7 +514,15 @@
         PPStartCond.pop_back();        
         // Add the new entry to PPCond.      
         PPCond.push_back(std::make_pair(HashOff, index));
-        break;
+        EmitToken(Tok);
+        
+        // Some files have gibberish on the same line as '#endif'.
+        // Discard these tokens.
+        do L.LexFromRawLexer(Tok); while (!Tok.is(tok::eof) &&
+                                          !Tok.isAtStartOfLine());
+        // We have the next token in hand.
+        // Don't immediately lex the next one.
+        goto NextToken;        
       }
       case tok::pp_elif:
       case tok::pp_else: {





More information about the cfe-commits mailing list