[PATCH] PR23872 Integrated assembler error message when using .type directive with @ in AArch32 assembly

Gabor Ballabas gaborb at inf.u-szeged.hu
Tue Jun 23 06:40:15 PDT 2015


Hi richard.barton.arm, kristof.beyls, rengolin,

In AArch32 assembler the @ is a comment symbol, so the error message shouldn't suggest
that '@<type>' is a valid replacement when assembling AArch32.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10651

Files:
  lib/MC/MCParser/ELFAsmParser.cpp
  test/MC/ELF/gnu-type-diagnostics.s

Index: lib/MC/MCParser/ELFAsmParser.cpp
===================================================================
--- lib/MC/MCParser/ELFAsmParser.cpp
+++ lib/MC/MCParser/ELFAsmParser.cpp
@@ -593,10 +593,16 @@
     Lex();
 
   if (getLexer().isNot(AsmToken::Identifier) &&
-      getLexer().isNot(AsmToken::Hash) && getLexer().isNot(AsmToken::At) &&
-      getLexer().isNot(AsmToken::Percent) && getLexer().isNot(AsmToken::String))
-    return TokError("expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', '@<type>', "
-                    "'%<type>' or \"<type>\"");
+      getLexer().isNot(AsmToken::Hash) &&
+      getLexer().isNot(AsmToken::Percent) &&
+      getLexer().isNot(AsmToken::String)) {
+    if (!getLexer().getAllowAtInIdentifier())
+      return TokError("expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', "
+                      "'%<type>' or \"<type>\"");
+    else if (getLexer().isNot(AsmToken::At))
+      return TokError("expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', '@<type>', "
+                      "'%<type>' or \"<type>\"");
+  }
 
   if (getLexer().isNot(AsmToken::String) &&
       getLexer().isNot(AsmToken::Identifier))
Index: test/MC/ELF/gnu-type-diagnostics.s
===================================================================
--- test/MC/ELF/gnu-type-diagnostics.s
+++ test/MC/ELF/gnu-type-diagnostics.s
@@ -1,4 +1,7 @@
 // RUN: not llvm-mc -triple i686-elf -filetype asm -o /dev/null %s 2>&1 | FileCheck %s
+// RUN: not llvm-mc -triple aarch64-elf -filetype asm -o /dev/null %s 2>&1 | FileCheck %s
+// RUN: not llvm-mc -triple arm-elf -filetype asm -o /dev/null %s 2>&1 \
+// RUN:     | FileCheck -check-prefix=CHECK-INVALID-AT-IN-TYPE-DIRECTIVE %s
 
 	.type TYPE FUNC
 // CHECK: error: unsupported attribute in '.type' directive
@@ -15,4 +18,7 @@
 // CHECK: .type symbol 32
 // CHECK:              ^
 
+// CHECK-INVALID-AT-IN-TYPE-DIRECTIVE: error: expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', '%<type>' or "<type>"
+// CHECK-INVALID-AT-IN-TYPE-DIRECTIVE: .type symbol 32
+// CHECK-INVALID-AT-IN-TYPE-DIRECTIVE:              ^

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10651.28234.patch
Type: text/x-patch
Size: 2055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150623/f9865c9f/attachment.bin>


More information about the llvm-commits mailing list