]> granicus.if.org Git - clang/commitdiff
Fix a crash that can occur when a #pragma handler eats to the end of the
authorChris Lattner <sabre@nondot.org>
Thu, 18 Jun 2009 05:55:53 +0000 (05:55 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 18 Jun 2009 05:55:53 +0000 (05:55 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73689 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Pragma.cpp

index 9776c2cfbd9eac72f3f4dc2794ea9338be99d433..3227d1cf09c57969394357b4685c059d2c7daf4a 100644 (file)
@@ -93,7 +93,7 @@ void Preprocessor::HandlePragmaDirective() {
   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();
 }