[llvm] r199035 - ARM IAS: fix diagnostics of improper qualification

Saleem Abdulrasool compnerd at compnerd.org
Sat Jan 11 21:25:44 PST 2014


Author: compnerd
Date: Sat Jan 11 23:25:44 2014
New Revision: 199035

URL: http://llvm.org/viewvc/llvm-project?rev=199035&view=rev
Log:
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.

Added:
    llvm/trunk/test/MC/ARM/arm-qualifier-diagnostics.s
Modified:
    llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp

Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=199035&r1=199034&r2=199035&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Sat Jan 11 23:25:44 2014
@@ -5325,6 +5325,7 @@ bool ARMAsmParser::ParseInstruction(Pars
     // 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");
     }

Added: llvm/trunk/test/MC/ARM/arm-qualifier-diagnostics.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/arm-qualifier-diagnostics.s?rev=199035&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/arm-qualifier-diagnostics.s (added)
+++ llvm/trunk/test/MC/ARM/arm-qualifier-diagnostics.s Sat Jan 11 23:25:44 2014
@@ -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:            ^
+





More information about the llvm-commits mailing list