aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-12-12 22:45:52 +0000
committerChad Rosier <mcrosier@apple.com>2012-12-12 22:45:52 +0000
commit5749801caaf523e2e151eea4cacc87299a4b3822 (patch)
tree3b638e6f7ff398538e6b018c6477e69b8624deb6 /lib/MC/MCParser/AsmParser.cpp
parentae3ce26f995f4747516a756f73d152c7188ff43b (diff)
[ms-inline asm] Make sure we fail gracefully on parse errors. Parse errors
should only occur on invalid input. Instruction matching errors aren't unexpected, so we can't rely on the AsmParsers HadError variable directly. rdar://12840278 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170037 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 2c06604be2..f7798c511f 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -97,11 +97,14 @@ struct ParseStatementInfo {
/// Opcode - The opcode from the last parsed instruction.
unsigned Opcode;
+ /// Error - Was there an error parsing the inline assembly?
+ bool ParseError;
+
SmallVectorImpl<AsmRewrite> *AsmRewrites;
- ParseStatementInfo() : Opcode(~0U), AsmRewrites(0) {}
+ ParseStatementInfo() : Opcode(~0U), ParseError(false), AsmRewrites(0) {}
ParseStatementInfo(SmallVectorImpl<AsmRewrite> *rewrites)
- : Opcode(~0), AsmRewrites(rewrites) {}
+ : Opcode(~0), ParseError(false), AsmRewrites(rewrites) {}
~ParseStatementInfo() {
// Free any parsed operands.
@@ -1385,6 +1388,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) {
ParseInstructionInfo IInfo(Info.AsmRewrites);
bool HadError = getTargetParser().ParseInstruction(IInfo, OpcodeStr.str(),
IDLoc,Info.ParsedOperands);
+ Info.ParseError = HadError;
// Dump the parsed representation, if requested.
if (getShowParsedOperands()) {
@@ -3705,6 +3709,9 @@ bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString,
if (ParseStatement(Info))
return true;
+ if (Info.ParseError)
+ return true;
+
if (Info.Opcode != ~0U) {
const MCInstrDesc &Desc = MII->get(Info.Opcode);