[llvm] 6e7406c - [MCParser, test] Improve macro argument charset test (#218828)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 20:16:24 PDT 2026


Author: Fangrui Song
Date: 2026-08-25T20:16:18-07:00
New Revision: 6e7406cbcc86a6b395143a2b0610ad1c300b40fe

URL: https://github.com/llvm/llvm-project/commit/6e7406cbcc86a6b395143a2b0610ad1c300b40fe
DIFF: https://github.com/llvm/llvm-project/commit/6e7406cbcc86a6b395143a2b0610ad1c300b40fe.diff

LOG: [MCParser,test] Improve macro argument charset test (#218828)

'@', '#', and '?' are assembly identifier characters, but they terminate
a macro argument name.

Added: 
    

Modified: 
    llvm/test/MC/AsmParser/altmacro-arg.s
    llvm/test/MC/AsmParser/macro-arg.s

Removed: 
    


################################################################################
diff  --git a/llvm/test/MC/AsmParser/altmacro-arg.s b/llvm/test/MC/AsmParser/altmacro-arg.s
index 713f5ad4aeab7..ac1405474b0b5 100644
--- a/llvm/test/MC/AsmParser/altmacro-arg.s
+++ b/llvm/test/MC/AsmParser/altmacro-arg.s
@@ -10,6 +10,7 @@
 # CHECK:      .data
 # CHECK-NEXT: .ascii "b cc rbx"
 # CHECK-NEXT: .ascii "bcc ccx rbx raxx"
+# CHECK-NEXT: .ascii "b?x b at x b#x b!x a_"
 .macro gen a, ra, rax
   ja 1f
   xorq %rax, %rax
@@ -17,6 +18,7 @@
 .data
   .ascii "\a \ra \rax"
   .ascii "a\()ra ra\()x rax raxx"
+  .ascii "a?x a at x a#x a!x a_"
 .endm
 gen b, cc, rbx
 

diff  --git a/llvm/test/MC/AsmParser/macro-arg.s b/llvm/test/MC/AsmParser/macro-arg.s
index 19065402309ec..fd6a3b65d9dc1 100644
--- a/llvm/test/MC/AsmParser/macro-arg.s
+++ b/llvm/test/MC/AsmParser/macro-arg.s
@@ -100,3 +100,12 @@ ascii3 x - y z 1
 ascii3 1, (2 3)
 # CHECK: .ascii "1|(2 3)|"
 ascii3 1 (2 3)
+
+## '@', '#' and '?' are identifier characters, but they terminate a macro argument name.
+.macro charset a
+.ascii "\a?x|\a?|\a at x|\a#x|\a!x"
+\a?y:
+.endm
+# CHECK:      .ascii "fo?x|fo?|fo at x|fo#x|fo!x"
+# CHECK-NEXT: "fo?y":
+charset fo


        


More information about the llvm-commits mailing list