]> granicus.if.org Git - clang/commitdiff
fix eof check
authorChris Lattner <sabre@nondot.org>
Thu, 5 Mar 2009 07:27:50 +0000 (07:27 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 5 Mar 2009 07:27:50 +0000 (07:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66149 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/Parser.cpp

index 70a336678cdac40ab0c54a73667d67859d2d9a51..b66b4f34ce5a81d5b8acb6670cbaa547ca299f77 100644 (file)
@@ -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 << "<eof> parser at end of file\n";
     return;
   }
   
+  if (Tok.getLocation().isInvalid()) {
+    OS << "<unknown> 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";