Modified MCAsmLexer to return error information upward
[oota-llvm.git] / tools / llvm-mc / AsmParser.cpp
index ab37eb838300ce9018f5e0dc8fab346f5f88806a..eb77e8d395bd7f77874611425d50bc855488d45f 100644 (file)
@@ -101,7 +101,12 @@ bool AsmParser::TokError(const char *Msg) {
 }
 
 const AsmToken &AsmParser::Lex() {
-  return Lexer.Lex();
+  const AsmToken &tok = Lexer.Lex();
+  
+  if (tok.is(AsmToken::Error))
+    Lexer.PrintMessage(Lexer.getErrLoc(), Lexer.getErr(), "error");
+  
+  return tok;
 }
 
 bool AsmParser::Run() {