This fixes an assert in AArch64AsmParser::MatchAndEmitInstruction.
rdar://problem/
23081753
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250207
91177308-0d34-0410-b5e6-
96231b3b80d8
// suffix token operand. The short-form match failure is probably more
// relevant: use it instead.
if (MatchResult == Match_InvalidOperand && ErrorInfo == 1 &&
- ((AArch64Operand &)*Operands[1]).isToken() &&
+ Operands.size() > 1 && ((AArch64Operand &)*Operands[1]).isToken() &&
((AArch64Operand &)*Operands[1]).isTokenSuffix()) {
MatchResult = ShortFormNEONMatchResult;
ErrorInfo = ShortFormNEONErrorInfo;
; CHECK-ERRORS: error: invalid operand for instruction
; CHECK-ERRORS: b.eq 0, 0
; CHECK-ERRORS: ^
+
+; Check that we give the proper "too few operands" diagnostic instead of
+; asserting.
+
+ ldr
+
+; CHECK-ERRORS: error: too few operands for instruction
+; CHECK-ERRORS: ldr
+; CHECK-ERRORS: ^