From: Chris Lattner Date: Thu, 5 Mar 2009 07:27:50 +0000 (+0000) Subject: fix eof check X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ddcbc0a72a04a5ae2493088f1437200a9ea480b1;p=clang fix eof check git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66149 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 70a336678c..b66b4f34ce 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -43,11 +43,16 @@ Parser::Parser(Preprocessor &pp, Action &actions) /// what the current token is. void PrettyStackTraceParserEntry::print(llvm::raw_ostream &OS) const { const Token &Tok = P.getCurToken(); - if (Tok.getLocation().isInvalid()) { + if (Tok.is(tok::eof)) { OS << " parser at end of file\n"; return; } + if (Tok.getLocation().isInvalid()) { + OS << " parser at unknown location\n"; + return; + } + const Preprocessor &PP = P.getPreprocessor(); Tok.getLocation().print(OS, PP.getSourceManager()); OS << ": current parser token '" << PP.getSpelling(Tok) << "'\n";