diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -2904,9 +2904,8 @@ if (parseSymbolicImmVal(Imm)) return MatchOperand_ParseFail; else if (Parser.getTok().isNot(AsmToken::Comma)) { - SMLoc E = Parser.getTok().getLoc(); Operands.push_back( - AArch64Operand::CreateImm(Imm, S, E, getContext())); + AArch64Operand::CreateImm(Imm, S, getLoc(), getContext())); return MatchOperand_Success; } @@ -2916,7 +2915,7 @@ // The optional operand must be "lsl #N" where N is non-negative. if (!Parser.getTok().is(AsmToken::Identifier) || !Parser.getTok().getIdentifier().equals_insensitive("lsl")) { - Error(Parser.getTok().getLoc(), "only 'lsl #+N' valid after immediate"); + Error(getLoc(), "only 'lsl #+N' valid after immediate"); return MatchOperand_ParseFail; } @@ -2926,28 +2925,27 @@ parseOptionalToken(AsmToken::Hash); if (Parser.getTok().isNot(AsmToken::Integer)) { - Error(Parser.getTok().getLoc(), "only 'lsl #+N' valid after immediate"); + Error(getLoc(), "only 'lsl #+N' valid after immediate"); return MatchOperand_ParseFail; } int64_t ShiftAmount = Parser.getTok().getIntVal(); if (ShiftAmount < 0) { - Error(Parser.getTok().getLoc(), "positive shift amount required"); + Error(getLoc(), "positive shift amount required"); return MatchOperand_ParseFail; } Parser.Lex(); // Eat the number // Just in case the optional lsl #0 is used for immediates other than zero. if (ShiftAmount == 0 && Imm != nullptr) { - SMLoc E = Parser.getTok().getLoc(); - Operands.push_back(AArch64Operand::CreateImm(Imm, S, E, getContext())); + Operands.push_back( + AArch64Operand::CreateImm(Imm, S, getLoc(), getContext())); return MatchOperand_Success; } - SMLoc E = Parser.getTok().getLoc(); - Operands.push_back(AArch64Operand::CreateShiftedImm(Imm, ShiftAmount, - S, E, getContext())); + Operands.push_back(AArch64Operand::CreateShiftedImm(Imm, ShiftAmount, S, + getLoc(), getContext())); return MatchOperand_Success; } @@ -3150,7 +3148,7 @@ // Make sure we do actually have a number, identifier or a parenthesized // expression. - SMLoc E = Parser.getTok().getLoc(); + SMLoc E = getLoc(); if (!Parser.getTok().is(AsmToken::Integer) && !Parser.getTok().is(AsmToken::LParen) && !Parser.getTok().is(AsmToken::Identifier)) { @@ -4058,8 +4056,8 @@ return false; } case AsmToken::LBrac: { - SMLoc Loc = Parser.getTok().getLoc(); - Operands.push_back(AArch64Operand::CreateToken("[", Loc, getContext())); + Operands.push_back( + AArch64Operand::CreateToken("[", getLoc(), getContext())); Parser.Lex(); // Eat '[' // There's no comma after a '[', so we can parse the next operand @@ -4070,8 +4068,8 @@ if (!parseNeonVectorList(Operands)) return false; - SMLoc Loc = Parser.getTok().getLoc(); - Operands.push_back(AArch64Operand::CreateToken("{", Loc, getContext())); + Operands.push_back( + AArch64Operand::CreateToken("{", getLoc(), getContext())); Parser.Lex(); // Eat '{' // There's no comma after a '{', so we can parse the next operand diff --git a/llvm/test/MC/AArch64/shift_extend_op_w_symbol.s b/llvm/test/MC/AArch64/shift_extend_op_w_symbol.s --- a/llvm/test/MC/AArch64/shift_extend_op_w_symbol.s +++ b/llvm/test/MC/AArch64/shift_extend_op_w_symbol.s @@ -1,6 +1,6 @@ // RUN: not llvm-mc -triple aarch64-none-linux-gnu < %s > %t1 2> %t2 // RUN: FileCheck < %t1 %s -// RUN: FileCheck --check-prefix=CHECK-ERROR < %t2 %s +// RUN: FileCheck --match-full-lines --strict-whitespace --check-prefix=CHECK-ERROR < %t2 %s .globl _func _func: @@ -37,6 +37,6 @@ add w1, w2, w3, lsl #IMM3 -// CHECK-ERROR: error: expected constant '#imm' after shift specifier +// CHECK-ERROR:{{.*}}error: expected constant '#imm' after shift specifier // CHECK-ERROR: add w1, w2, w3, lsl #IMM3 // CHECK-ERROR: ^