summaryrefslogtreecommitdiffstats
path: root/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
commit34e53140c2cc02ce4c9d060e48302576d3962e1c (patch)
tree2935f144ee34b31941cc1ead2b3916111afb1a3f /lib
parent9607c40601b345c21af9de97ec03e124179efd24 (diff)
downloadexternal_llvm-34e53140c2cc02ce4c9d060e48302576d3962e1c.zip
external_llvm-34e53140c2cc02ce4c9d060e48302576d3962e1c.tar.gz
external_llvm-34e53140c2cc02ce4c9d060e48302576d3962e1c.tar.bz2
change the MC "ParseInstruction" interface to make it the
implementation's job to check for and lex the EndOfStatement marker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113347 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp7
-rw-r--r--lib/Target/ARM/AsmParser/ARMAsmParser.cpp5
-rw-r--r--lib/Target/X86/AsmParser/X86AsmParser.cpp4
3 files changed, 9 insertions, 7 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index f83cd5e..310574f 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/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/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index f2099d2..f44470b 100644
--- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/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/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 58e4554..068ed56 100644
--- a/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/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") ||