[llvm] r234174 - Use a comma after the unique keyword.

Rafael Espindola rafael.espindola at gmail.com
Mon Apr 6 09:34:42 PDT 2015


Author: rafael
Date: Mon Apr  6 11:34:41 2015
New Revision: 234174

URL: http://llvm.org/viewvc/llvm-project?rev=234174&view=rev
Log:
Use a comma after the unique keyword.

H.J. Lu noted that all .section options are separated by a comma.

This patch changes the syntax of unique to require one.

Added:
    llvm/trunk/test/MC/ELF/section-unique-err4.s
Modified:
    llvm/trunk/docs/Extensions.rst
    llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
    llvm/trunk/lib/MC/MCSectionELF.cpp
    llvm/trunk/test/MC/ELF/section-unique-err1.s
    llvm/trunk/test/MC/ELF/section-unique-err2.s
    llvm/trunk/test/MC/ELF/section-unique-err3.s
    llvm/trunk/test/MC/ELF/section-unique.s

Modified: llvm/trunk/docs/Extensions.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Extensions.rst?rev=234174&r1=234173&r2=234174&view=diff
==============================================================================
--- llvm/trunk/docs/Extensions.rst (original)
+++ llvm/trunk/docs/Extensions.rst Mon Apr  6 11:34:41 2015
@@ -178,10 +178,10 @@ For example, the following code creates
 
 .. code-block:: gas
 
-	.section	.text,"ax", at progbits,unique 1
+	.section	.text,"ax", at progbits,unique,1
         nop
 
-	.section	.text,"ax", at progbits,unique 2
+	.section	.text,"ax", at progbits,unique,2
         nop
 
 

Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=234174&r1=234173&r2=234174&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Mon Apr  6 11:34:41 2015
@@ -470,6 +470,9 @@ bool ELFAsmParser::ParseSectionArguments
           return TokError("expected identifier in directive");
         if (UniqueStr != "unique")
           return TokError("expected 'unique'");
+        if (getLexer().isNot(AsmToken::Comma))
+          return TokError("expected commma");
+        Lex();
         if (getParser().parseAbsoluteExpression(UniqueID))
           return true;
         if (UniqueID < 0)

Modified: llvm/trunk/lib/MC/MCSectionELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionELF.cpp?rev=234174&r1=234173&r2=234174&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionELF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionELF.cpp Mon Apr  6 11:34:41 2015
@@ -149,7 +149,7 @@ void MCSectionELF::PrintSwitchToSection(
   }
 
   if (isUnique())
-    OS << ",unique " << UniqueID;
+    OS << ",unique," << UniqueID;
 
   OS << '\n';
 

Modified: llvm/trunk/test/MC/ELF/section-unique-err1.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/section-unique-err1.s?rev=234174&r1=234173&r2=234174&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/section-unique-err1.s (original)
+++ llvm/trunk/test/MC/ELF/section-unique-err1.s Mon Apr  6 11:34:41 2015
@@ -2,4 +2,4 @@
 
 // CHECK:  error: expected absolute expression
 
-        .section	.text,"ax", at progbits,unique "abc"
+        .section	.text,"ax", at progbits,unique, "abc"

Modified: llvm/trunk/test/MC/ELF/section-unique-err2.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/section-unique-err2.s?rev=234174&r1=234173&r2=234174&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/section-unique-err2.s (original)
+++ llvm/trunk/test/MC/ELF/section-unique-err2.s Mon Apr  6 11:34:41 2015
@@ -2,4 +2,4 @@
 
 // CHECK:  error: unique id must be positive
 
-        .section	.text,"ax", at progbits,unique -1
+        .section	.text,"ax", at progbits,unique, -1

Modified: llvm/trunk/test/MC/ELF/section-unique-err3.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/section-unique-err3.s?rev=234174&r1=234173&r2=234174&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/section-unique-err3.s (original)
+++ llvm/trunk/test/MC/ELF/section-unique-err3.s Mon Apr  6 11:34:41 2015
@@ -2,4 +2,4 @@
 
 // CHECK:  error: unique id is too large
 
-        .section	.text,"ax", at progbits,unique 4294967295
+        .section	.text,"ax", at progbits,unique, 4294967295

Added: llvm/trunk/test/MC/ELF/section-unique-err4.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/section-unique-err4.s?rev=234174&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/section-unique-err4.s (added)
+++ llvm/trunk/test/MC/ELF/section-unique-err4.s Mon Apr  6 11:34:41 2015
@@ -0,0 +1,5 @@
+// RUN: not llvm-mc -triple x86_64-pc-linux-gnu %s -o - 2>&1 | FileCheck %s
+
+// CHECK:  error: expected commma
+
+        .section	.text,"ax", at progbits,unique 1

Modified: llvm/trunk/test/MC/ELF/section-unique.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/section-unique.s?rev=234174&r1=234173&r2=234174&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/section-unique.s (original)
+++ llvm/trunk/test/MC/ELF/section-unique.s Mon Apr  6 11:34:41 2015
@@ -1,22 +1,22 @@
 // RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s
 // RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -t | FileCheck %s --check-prefix=OBJ
 
-	.section	.text,"ax", at progbits,unique 4294967293
+	.section	.text,"ax", at progbits,unique, 4294967293
         .globl	f
 f:
         nop
 
-	.section	.text,"ax", at progbits,unique 4294967294
+	.section	.text,"ax", at progbits,unique, 4294967294
         .globl	g
 g:
         nop
 
 // test that f and g are in different sections.
 
-// CHECK: .section	.text,"ax", at progbits,unique 4294967293
+// CHECK: .section	.text,"ax", at progbits,unique,4294967293
 // CHECK: f:
 
-// CHECK: .section	.text,"ax", at progbits,unique 4294967294
+// CHECK: .section	.text,"ax", at progbits,unique,4294967294
 // CHECK: g:
 
 // OBJ: Symbol {





More information about the llvm-commits mailing list