]> granicus.if.org Git - llvm/commitdiff
[Asm] Don't list '@<type>' in diag when '@' is a comment
authorOliver Stannard <oliver.stannard@arm.com>
Fri, 17 Mar 2017 11:10:17 +0000 (11:10 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Fri, 17 Mar 2017 11:10:17 +0000 (11:10 +0000)
This fixes https://bugs.llvm.org//show_bug.cgi?id=31280

Differential revision: https://reviews.llvm.org/D31026

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

lib/MC/MCParser/ELFAsmParser.cpp
test/MC/ELF/ARM/gnu-type-hash-diagnostics.s

index 4ac16615cebdaf273308c1f08512e26a436b32a2..337cf16e86504263a4cae60203ae176795784394 100644 (file)
@@ -391,8 +391,12 @@ bool ELFAsmParser::maybeParseSectionType(StringRef &TypeName) {
     return false;
   Lex();
   if (L.isNot(AsmToken::At) && L.isNot(AsmToken::Percent) &&
-      L.isNot(AsmToken::String))
-    return TokError("expected '@<type>', '%<type>' or \"<type>\"");
+      L.isNot(AsmToken::String)) {
+    if (L.getAllowAtInIdentifier())
+      return TokError("expected '@<type>', '%<type>' or \"<type>\"");
+    else
+      return TokError("expected '%<type>' or \"<type>\"");
+  }
   if (!L.is(AsmToken::String))
     Lex();
   if (L.is(AsmToken::Integer)) {
index eb364755c4d75d64ef6d2b833516bc13e2791c10..7dc656d5a4d76b2bb40b73a4a21458d5f297d1ec 100644 (file)
@@ -7,3 +7,7 @@
 // CHECK: .type TYPE #32
 // CHECK:             ^
 
+  // For ARM, the comment character is '@', so we don't list '@<type>' as a
+  // valid option.
+  .section "foo", "a", @progbits
+// CHECK: error: expected '%<type>' or "<type>"