mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
X86AsmParser: Do not process a non-existent token
This error can only happen if an unfinished operation is at Eof. Patch by Brandon Jones Differential Revision: https://reviews.llvm.org/D57379 llvm-svn: 356972
This commit is contained in:
parent
af6f88a0b5
commit
189f436b89
@ -2992,6 +2992,11 @@ bool X86AsmParser::MatchAndEmitATTInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
case Match_MnemonicFail:
|
||||
break;
|
||||
}
|
||||
if (Op.getToken().empty()) {
|
||||
Error(IDLoc, "instruction must have size higher than 0", EmptyRange,
|
||||
MatchingInlineAsm);
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME: Ideally, we would only attempt suffix matches for things which are
|
||||
// valid prefixes, and we could just infer the right unambiguous
|
||||
|
4
test/MC/AsmParser/unfinished-op.s
Normal file
4
test/MC/AsmParser/unfinished-op.s
Normal file
@ -0,0 +1,4 @@
|
||||
# RUN: not llvm-mc -triple i386-unknown-unknown %s 2>&1 > /dev/null| FileCheck %s --check-prefix=CHECK-ERROR
|
||||
|
||||
#CHECK-ERROR: error: instruction must have size higher than 0
|
||||
.byte 64;""
|
@ -9,7 +9,7 @@
|
||||
addl $a, %eax
|
||||
# CHECK: addl $3, %eax
|
||||
addl $1 + 2, %eax
|
||||
|
||||
|
||||
# Disambiguation
|
||||
|
||||
# CHECK: addl $1, 8
|
||||
@ -26,7 +26,7 @@
|
||||
addl $1, (%eax)
|
||||
# CHECK: addl $1, 8(,%eax)
|
||||
addl $1, (4+4)(,%eax)
|
||||
|
||||
|
||||
# Indirect Memory Operands
|
||||
# CHECK: addl $1, 1(%eax)
|
||||
addl $1, 1(%eax)
|
||||
|
Loading…
Reference in New Issue
Block a user