mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
[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
This commit is contained in:
parent
ae3ce26f99
commit
5749801caa
@ -97,11 +97,14 @@ struct ParseStatementInfo {
|
|||||||
/// Opcode - The opcode from the last parsed instruction.
|
/// Opcode - The opcode from the last parsed instruction.
|
||||||
unsigned Opcode;
|
unsigned Opcode;
|
||||||
|
|
||||||
|
/// Error - Was there an error parsing the inline assembly?
|
||||||
|
bool ParseError;
|
||||||
|
|
||||||
SmallVectorImpl<AsmRewrite> *AsmRewrites;
|
SmallVectorImpl<AsmRewrite> *AsmRewrites;
|
||||||
|
|
||||||
ParseStatementInfo() : Opcode(~0U), AsmRewrites(0) {}
|
ParseStatementInfo() : Opcode(~0U), ParseError(false), AsmRewrites(0) {}
|
||||||
ParseStatementInfo(SmallVectorImpl<AsmRewrite> *rewrites)
|
ParseStatementInfo(SmallVectorImpl<AsmRewrite> *rewrites)
|
||||||
: Opcode(~0), AsmRewrites(rewrites) {}
|
: Opcode(~0), ParseError(false), AsmRewrites(rewrites) {}
|
||||||
|
|
||||||
~ParseStatementInfo() {
|
~ParseStatementInfo() {
|
||||||
// Free any parsed operands.
|
// Free any parsed operands.
|
||||||
@ -1385,6 +1388,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) {
|
|||||||
ParseInstructionInfo IInfo(Info.AsmRewrites);
|
ParseInstructionInfo IInfo(Info.AsmRewrites);
|
||||||
bool HadError = getTargetParser().ParseInstruction(IInfo, OpcodeStr.str(),
|
bool HadError = getTargetParser().ParseInstruction(IInfo, OpcodeStr.str(),
|
||||||
IDLoc,Info.ParsedOperands);
|
IDLoc,Info.ParsedOperands);
|
||||||
|
Info.ParseError = HadError;
|
||||||
|
|
||||||
// Dump the parsed representation, if requested.
|
// Dump the parsed representation, if requested.
|
||||||
if (getShowParsedOperands()) {
|
if (getShowParsedOperands()) {
|
||||||
@ -3705,6 +3709,9 @@ bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString,
|
|||||||
if (ParseStatement(Info))
|
if (ParseStatement(Info))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (Info.ParseError)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (Info.Opcode != ~0U) {
|
if (Info.Opcode != ~0U) {
|
||||||
const MCInstrDesc &Desc = MII->get(Info.Opcode);
|
const MCInstrDesc &Desc = MII->get(Info.Opcode);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user