diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-19 22:21:33 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-19 22:21:33 +0000 |
commit | 76c3441a4eef8d605831f0e16e8f996efebedef5 (patch) | |
tree | 7a75cd116a0aea338a229b7ee3490c0c03d511e9 /clang/lib/Lex/PPDirectives.cpp | |
parent | f4d95fdce9101b959c093f08d6df881886edcc07 (diff) | |
download | bcm5719-llvm-76c3441a4eef8d605831f0e16e8f996efebedef5.tar.gz bcm5719-llvm-76c3441a4eef8d605831f0e16e8f996efebedef5.zip |
When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().
llvm-svn: 59668
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index a1216b15bcc..68f49574997 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -473,10 +473,15 @@ void Preprocessor::HandleUserDiagnosticDirective(Token &Tok, // 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. |