mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
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 ^~~ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142135 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
04a0426cc2
commit
f82edaffb1
@ -322,7 +322,8 @@ struct X86Operand : public MCParsedAsmOperand {
|
||||
}
|
||||
|
||||
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 @@ MatchAndEmitInstruction(SMLoc IDLoc,
|
||||
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user