Parse Tag_compatibility correctly.
authorCharlie Turner <charlie.turner@arm.com>
Mon, 5 Jan 2015 13:26:37 +0000 (13:26 +0000)
committerCharlie Turner <charlie.turner@arm.com>
Mon, 5 Jan 2015 13:26:37 +0000 (13:26 +0000)
Tag_compatibility takes two arguments, but before this patch it would
erroneously accept just one, it now produces an error in that case.

Change-Id: I530f918587620d0d5dfebf639944d6083871ef7d

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225167 91177308-0d34-0410-b5e6-96231b3b80d8

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 93af30c83c3ca39746b9d633f175bda9f5a9717a..dd63d6172e224ff081575257feefd97ec3fe3590 100644 (file)
@@ -9130,8 +9130,13 @@ bool ARMAsmParser::parseDirectiveEabiAttr(SMLoc L) {
   if (Tag == ARMBuildAttrs::compatibility) {
     if (Parser.getTok().isNot(AsmToken::Comma))
       IsStringValue = false;
   if (Tag == ARMBuildAttrs::compatibility) {
     if (Parser.getTok().isNot(AsmToken::Comma))
       IsStringValue = false;
-    else
-      Parser.Lex();
+    if (Parser.getTok().isNot(AsmToken::Comma)) {
+      Error(Parser.getTok().getLoc(), "comma expected");
+      Parser.eatToEndOfStatement();
+      return false;
+    } else {
+       Parser.Lex();
+    }
   }
 
   if (IsStringValue) {
   }
 
   if (IsStringValue) {
index d1ae352b25f4fa33c6846ffb61559d650e9c747e..2b0375e576136f9247db9baf1500595c45ee741d 100644 (file)
 @ CHECK:       .eabi_attribute 0
 @ CHECK:                         ^
 
 @ CHECK:       .eabi_attribute 0
 @ CHECK:                         ^
 
+        .eabi_attribute Tag_compatibility, 1
+@ CHECK: error: comma expected
+@ CHECK: .eabi_attribute Tag_compatibility, 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
        .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
index 69342b2cd81f053b02edecf8ccd8cb3872e85630..e2c509972754af64cfdf28da81ed8761bc78258b 100644 (file)
@@ -3,8 +3,6 @@
 
        .syntax unified
        .thumb
 
        .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 {
        .eabi_attribute Tag_compatibility, 1, "aeabi"
 
 @ CHECK-ATTR: FileAttributes {
index ac7358f39d7c3133952dc526d5aeb03488722d02..74a51ab7279a7cc9a11752d349f95aa19c58f2d3 100644 (file)
 @ CHECK-OBJ-NEXT:   Value: 1
 @ CHECK-OBJ-NEXT:   TagName: ABI_FP_optimization_goals
 @ CHECK-OBJ-NEXT:   Description: Speed
 @ 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
        .eabi_attribute Tag_compatibility, 1, "aeabi"
 @ CHECK: .eabi_attribute 32, 1, "aeabi"
 @ CHECK-OBJ:        Tag: 32