[PATCH] [ARM] Parse Tag_compatibility correctly.

Charlie Turner charlie.turner at arm.com
Thu Dec 18 05:30:15 PST 2014


Tag_compatibility takes two arguments, but before this patch it would
erroneously accept just one, it now produces an error in that case.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6720

Files:
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  test/MC/ARM/directive-eabi_attribute-diagnostics.s
  test/MC/ARM/directive-eabi_attribute-overwrite.s
  test/MC/ARM/directive-eabi_attribute.s

Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -9068,10 +9068,13 @@
   }
 
   if (Tag == ARMBuildAttrs::compatibility) {
-    if (Parser.getTok().isNot(AsmToken::Comma))
-      IsStringValue = false;
-    else
+    if (Parser.getTok().isNot(AsmToken::Comma)) {
+      Error(Parser.getTok().getLoc(), "comma expected");
+      Parser.eatToEndOfStatement();
+      return false;
+    } else {
       Parser.Lex();
+    }
   }
 
   if (IsStringValue) {
Index: test/MC/ARM/directive-eabi_attribute-diagnostics.s
===================================================================
--- test/MC/ARM/directive-eabi_attribute-diagnostics.s
+++ test/MC/ARM/directive-eabi_attribute-diagnostics.s
@@ -28,9 +28,12 @@
 @ CHECK: error: comma expected
 @ CHECK: 	.eabi_attribute 0
 @ CHECK:                         ^
+	.eabi_attribute Tag_conformance 1
+@ CHECK: error: comma expected
+@ CHECK: .eabi_attribute Tag_conformance 1
+@ CHECK:                                 ^
 
 	.eabi_attribute Tag_MPextension_use_old, 0
 @ CHECK: error: attribute name not recognised: Tag_MPextension_use_old
 @ CHECK: 	.eabi_attribute Tag_MPextension_use_old, 0
 @ CHECK:                        ^
-
Index: test/MC/ARM/directive-eabi_attribute-overwrite.s
===================================================================
--- test/MC/ARM/directive-eabi_attribute-overwrite.s
+++ test/MC/ARM/directive-eabi_attribute-overwrite.s
@@ -3,8 +3,6 @@
 
 	.syntax unified
 	.thumb
-@ FIXME: The next directive is not correct, Tag_compatibility isn't getting parsed correctly.
-	.eabi_attribute Tag_compatibility, 1
 	.eabi_attribute Tag_compatibility, 1, "aeabi"
 
 @ CHECK-ATTR: FileAttributes {
Index: test/MC/ARM/directive-eabi_attribute.s
===================================================================
--- test/MC/ARM/directive-eabi_attribute.s
+++ test/MC/ARM/directive-eabi_attribute.s
@@ -165,8 +165,6 @@
 @ CHECK-OBJ-NEXT:   Value: 1
 @ CHECK-OBJ-NEXT:   TagName: ABI_FP_optimization_goals
 @ CHECK-OBJ-NEXT:   Description: Speed
-	.eabi_attribute Tag_compatibility, 1
-@ CHECK: .eabi_attribute 32, 1
 	.eabi_attribute Tag_compatibility, 1, "aeabi"
 @ CHECK: .eabi_attribute 32, 1, "aeabi"
 @ CHECK-OBJ:        Tag: 32

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6720.17439.patch
Type: text/x-patch
Size: 2359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141218/5608a5fe/attachment.bin>


More information about the llvm-commits mailing list