When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59668 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index a1216b1..68f4957 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -473,10 +473,15 @@
   // tokens.  For example, this is allowed: "#warning `   'foo".  GCC does
   // collapse multiple consequtive white space between tokens, but this isn't
   // specified by the standard.
-  std::string Message = CurLexer->ReadToEndOfLine();
-
-  unsigned DiagID = isWarning ? diag::pp_hash_warning : diag::err_pp_hash_error;
-  Diag(Tok, DiagID) << Message;
+  
+  if (CurLexer) {
+    std::string Message = CurLexer->ReadToEndOfLine();
+    unsigned DiagID = isWarning ? diag::pp_hash_warning : diag::err_pp_hash_error;
+    Diag(Tok, DiagID) << Message;
+  }
+  else {
+    CurPTHLexer->DiscardToEndOfLine();
+  }    
 }
 
 /// HandleIdentSCCSDirective - Handle a #ident/#sccs directive.