[llvm-commits] [llvm] r74728 - /llvm/trunk/tools/llvm-mc/AsmParser.cpp
Chris Lattner
sabre at nondot.org
Thu Jul 2 14:53:43 PDT 2009
Author: lattner
Date: Thu Jul 2 16:53:43 2009
New Revision: 74728
URL: http://llvm.org/viewvc/llvm-project?rev=74728&view=rev
Log:
implement error recovery in the llvm-mc parser. Feel the power!
Modified:
llvm/trunk/tools/llvm-mc/AsmParser.cpp
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=74728&r1=74727&r2=74728&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Thu Jul 2 16:53:43 2009
@@ -40,11 +40,18 @@
// Prime the lexer.
Lexer.Lex();
- while (Lexer.isNot(asmtok::Eof))
- if (ParseStatement())
- return true;
+ bool HadError = false;
- return false;
+ // While we have input, parse each statement.
+ while (Lexer.isNot(asmtok::Eof)) {
+ if (!ParseStatement()) continue;
+
+ // If we had an error, remember it and recover by skipping to the next line.
+ HadError = true;
+ EatToEndOfStatement();
+ }
+
+ return HadError;
}
/// EatToEndOfStatement - Throw away the rest of the line for testing purposes.
More information about the llvm-commits
mailing list