From 3d83eb48ac55f20e16997e210a59486f3717402a Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 12 Jan 2014 05:25:44 +0000 Subject: [PATCH] ARM IAS: fix diagnostics of improper qualification An improper qualifier would result in a superfluous error due to the parser not consuming the remainder of the statement. Simply consume the remainder of the statement to avoid the error. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199035 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 1 + test/MC/ARM/arm-qualifier-diagnostics.s | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/MC/ARM/arm-qualifier-diagnostics.s diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index b1ac198c6c2..b8890a37df9 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -5325,6 +5325,7 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name, // For for ARM mode generate an error if the .n qualifier is used. if (ExtraToken == ".n" && !isThumb()) { SMLoc Loc = SMLoc::getFromPointer(NameLoc.getPointer() + Start); + Parser.eatToEndOfStatement(); return Error(Loc, "instruction with .n (narrow) qualifier not allowed in " "arm mode"); } diff --git a/test/MC/ARM/arm-qualifier-diagnostics.s b/test/MC/ARM/arm-qualifier-diagnostics.s new file mode 100644 index 00000000000..8b75eee5de2 --- /dev/null +++ b/test/MC/ARM/arm-qualifier-diagnostics.s @@ -0,0 +1,15 @@ +@ RUN: not llvm-mc -triple armv7-eabi -filetype asm -o - %s 2>&1 | FileCheck %s + + .syntax unified + + .type function,%function +function: + ldr.n r0, [r0] + +@ CHECK: error: instruction with .n (narrow) qualifier not allowed in arm mode +@ CHECK: ldr.n r0, [r0] +@ CHECK: ^ +@ CHECK-NOT: error: unexpected token in operand +@ CHECK-NOT: ldr.n r0, [r0] +@ CHECK-NOT: ^ + -- 2.34.1