[cfe-commits] r63000 - /cfe/trunk/lib/Lex/PPDirectives.cpp

Chris Lattner sabre at nondot.org
Sun Jan 25 21:30:54 PST 2009


Author: lattner
Date: Sun Jan 25 23:30:54 2009
New Revision: 63000

URL: http://llvm.org/viewvc/llvm-project?rev=63000&view=rev
Log:
a few minor cleanups

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

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

==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Sun Jan 25 23:30:54 2009
@@ -629,10 +629,12 @@
   // FIXME: do something with the #line info.
 }
 
-
+/// HandleUserDiagnosticDirective - Handle a #warning or #error directive.
+///
 void Preprocessor::HandleUserDiagnosticDirective(Token &Tok, 
                                                  bool isWarning) {
-  if (!CurLexer)
+  // PTH doesn't emit #warning or #error directives.
+  if (CurPTHLexer)
     return CurPTHLexer->DiscardToEndOfLine();
 
   // Read the rest of the line raw.  We do this because we don't want macros
@@ -661,6 +663,8 @@
   if (StrTok.isNot(tok::string_literal) &&
       StrTok.isNot(tok::wide_string_literal)) {
     Diag(StrTok, diag::err_pp_malformed_ident);
+    if (StrTok.isNot(tok::eom))
+      DiscardUntilEndOfDirective();
     return;
   }
   





More information about the cfe-commits mailing list