[cfe-commits] r73689 - /cfe/trunk/lib/Lex/Pragma.cpp

Chris Lattner sabre at nondot.org
Wed Jun 17 22:55:53 PDT 2009


Author: lattner
Date: Thu Jun 18 00:55:53 2009
New Revision: 73689

URL: http://llvm.org/viewvc/llvm-project?rev=73689&view=rev
Log:
Fix a crash that can occur when a #pragma handler eats to the end of the
line, and when the pragma is at the end of a file.  In this case, the last
token consumed could pop the lexer, invalidating CurPPLexer.  Thanks to
Peter Thoman for pointing it out.

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

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

==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Thu Jun 18 00:55:53 2009
@@ -93,7 +93,7 @@
   PragmaHandlers->HandlePragma(*this, Tok);
   
   // If the pragma handler didn't read the rest of the line, consume it now.
-  if (CurPPLexer->ParsingPreprocessorDirective)
+  if (CurPPLexer && CurPPLexer->ParsingPreprocessorDirective)
     DiscardUntilEndOfDirective();
 }
 





More information about the cfe-commits mailing list