[llvm-commits] [llvm] r142135 - /llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sun Oct 16 04:28:30 PDT 2011
Author: d0k
Date: Sun Oct 16 06:28:29 2011
New Revision: 142135
URL: http://llvm.org/viewvc/llvm-project?rev=142135&view=rev
Log:
X86AsmParser: Synthesize EndLoc for tokens out of StartLoc + Length and print ranges for invalid operands.
<stdin>:1:4: error: invalid instruction mnemonic 'abc'
abc incl %edi
^~~
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=142135&r1=142134&r2=142135&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Sun Oct 16 06:28:29 2011
@@ -322,7 +322,8 @@
}
static X86Operand *CreateToken(StringRef Str, SMLoc Loc) {
- X86Operand *Res = new X86Operand(Token, Loc, Loc);
+ SMLoc EndLoc = SMLoc::getFromPointer(Loc.getPointer() + Str.size() - 1);
+ X86Operand *Res = new X86Operand(Token, Loc, EndLoc);
Res->Tok.Data = Str.data();
Res->Tok.Length = Str.size();
return Res;
@@ -1083,8 +1084,8 @@
if ((Match1 == Match_MnemonicFail) && (Match2 == Match_MnemonicFail) &&
(Match3 == Match_MnemonicFail) && (Match4 == Match_MnemonicFail)) {
if (!WasOriginallyInvalidOperand) {
- Error(IDLoc, "invalid instruction mnemonic '" + Base + "'");
- return true;
+ return Error(IDLoc, "invalid instruction mnemonic '" + Base + "'",
+ Op->getLocRange());
}
// Recover location info for the operand if we know which was the problem.
More information about the llvm-commits
mailing list