1
0
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:
Craig Topper 2019-03-26 03:12:41 +00:00
parent af6f88a0b5
commit 189f436b89
3 changed files with 11 additions and 2 deletions

View File

@ -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

View 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;""

View File

@ -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)