summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-08 05:10:46 +0000
committerChris Lattner <sabre@nondot.org>2010-09-08 05:10:46 +0000
commit91689c1d0f1d8cb1f158b8bde65b66dd9e6c3be2 (patch)
tree8971747bbe7ab972434c0dee069d36cbb83a590d /llvm/lib
parent8caea68a4f6b209e73369b855829b32cd11d35af (diff)
downloadbcm5719-llvm-91689c1d0f1d8cb1f158b8bde65b66dd9e6c3be2.tar.gz
bcm5719-llvm-91689c1d0f1d8cb1f158b8bde65b66dd9e6c3be2.zip
change the MC "ParseInstruction" interface to make it the
implementation's job to check for and lex the EndOfStatement marker. llvm-svn: 113347
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp7
-rw-r--r--llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp5
-rw-r--r--llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp4
3 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index f83cd5eb2a1..310574fe27b 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -917,8 +917,6 @@ bool AsmParser::ParseStatement() {
SmallVector<MCParsedAsmOperand*, 8> ParsedOperands;
bool HadError = getTargetParser().ParseInstruction(Opcode.str(), IDLoc,
ParsedOperands);
- if (!HadError && Lexer.isNot(AsmToken::EndOfStatement))
- HadError = TokError("unexpected token in argument list");
// Dump the parsed representation, if requested.
if (getShowParsedOperands()) {
@@ -945,11 +943,6 @@ bool AsmParser::ParseStatement() {
HadError = true;
}
- // If there was no error, consume the end-of-statement token. Otherwise this
- // will be done by our caller.
- if (!HadError)
- Lex();
-
// Free any parsed operands.
for (unsigned i = 0, e = ParsedOperands.size(); i != e; ++i)
delete ParsedOperands[i];
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index f2099d29386..f44470b2c1b 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -737,6 +737,11 @@ bool ARMAsmParser::ParseInstruction(StringRef Name, SMLoc NameLoc,
Operands.push_back(Op.take());
}
}
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in argument list");
+ Parser.Lex(); // Consume the EndOfStatement
+
return false;
}
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 58e4554ab03..068ed56e951 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -786,6 +786,10 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
return true;
}
}
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in argument list");
+ Parser.Lex(); // Consume the EndOfStatement
// FIXME: Hack to handle recognizing s{hr,ar,hl}? $1.
if ((Name.startswith("shr") || Name.startswith("sar") ||
OpenPOWER on IntegriCloud