summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-02 21:53:43 +0000
committerChris Lattner <sabre@nondot.org>2009-07-02 21:53:43 +0000
commit73f3611be941b3b25fede1f45913d72d2b3e91b4 (patch)
treeedbe6ac10bbffc1a25e934576f9698d2c32903ab /llvm
parentb6fb62ceb087ee53ed2d84310fe0e1001bfd133f (diff)
downloadbcm5719-llvm-73f3611be941b3b25fede1f45913d72d2b3e91b4.tar.gz
bcm5719-llvm-73f3611be941b3b25fede1f45913d72d2b3e91b4.zip
implement error recovery in the llvm-mc parser. Feel the power!
llvm-svn: 74728
Diffstat (limited to 'llvm')
-rw-r--r--llvm/tools/llvm-mc/AsmParser.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/tools/llvm-mc/AsmParser.cpp b/llvm/tools/llvm-mc/AsmParser.cpp
index 339a16db8c2..f5bf5892012 100644
--- a/llvm/tools/llvm-mc/AsmParser.cpp
+++ b/llvm/tools/llvm-mc/AsmParser.cpp
@@ -40,11 +40,18 @@ bool AsmParser::Run() {
// 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.
OpenPOWER on IntegriCloud