1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -x assembler-with-cpp -E %s -o - | FileCheck -strict-whitespace -check-prefix=CHECK-Identifiers-False %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc #ifndef __ASSEMBLER__ 4*f4a2713aSLionel Sambuc #error "__ASSEMBLER__ not defined" 5*f4a2713aSLionel Sambuc #endif 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc // Invalid token pasting is ok. 9*f4a2713aSLionel Sambuc #define A X ## . 10*f4a2713aSLionel Sambuc 1: A 11*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: 1: X . 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc // Line markers are not linemarkers in .S files, they are passed through. 14*f4a2713aSLionel Sambuc # 321 15*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: # 321 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc // Unknown directives are passed through. 18*f4a2713aSLionel Sambuc # B C 19*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: # B C 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc // Unknown directives are expanded. 22*f4a2713aSLionel Sambuc #define D(x) BAR ## x 23*f4a2713aSLionel Sambuc # D(42) 24*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: # BAR42 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc // Unmatched quotes are permitted. 27*f4a2713aSLionel Sambuc 2: ' 28*f4a2713aSLionel Sambuc 3: " 29*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: 2: ' 30*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: 3: " 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc // (balance quotes to keep editors happy): "' 33*f4a2713aSLionel Sambuc 34*f4a2713aSLionel Sambuc // Empty char literals are ok. 35*f4a2713aSLionel Sambuc 4: '' 36*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: 4: '' 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc 39*f4a2713aSLionel Sambuc // Portions of invalid pasting should still expand as macros. 40*f4a2713aSLionel Sambuc // rdar://6709206 41*f4a2713aSLionel Sambuc #define M4 expanded 42*f4a2713aSLionel Sambuc #define M5() M4 ## ( 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc 5: M5() 45*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: 5: expanded ( 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc // rdar://6804322 48*f4a2713aSLionel Sambuc #define FOO(name) name ## $foo 49*f4a2713aSLionel Sambuc 6: FOO(blarg) 50*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: 6: blarg $foo 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -x assembler-with-cpp -fdollars-in-identifiers -E %s -o - | FileCheck -check-prefix=CHECK-Identifiers-True -strict-whitespace %s 53*f4a2713aSLionel Sambuc #define FOO(name) name ## $foo 54*f4a2713aSLionel Sambuc 7: FOO(blarg) 55*f4a2713aSLionel Sambuc // CHECK-Identifiers-True: 7: blarg$foo 56*f4a2713aSLionel Sambuc 57*f4a2713aSLionel Sambuc // 58*f4a2713aSLionel Sambuc #define T6() T6 #nostring 59*f4a2713aSLionel Sambuc #define T7(x) T7 #x 60*f4a2713aSLionel Sambuc 8: T6() 61*f4a2713aSLionel Sambuc 9: T7(foo) 62*f4a2713aSLionel Sambuc // CHECK-Identifiers-True: 8: T6 #nostring 63*f4a2713aSLionel Sambuc // CHECK-Identifiers-True: 9: T7 "foo" 64*f4a2713aSLionel Sambuc 65*f4a2713aSLionel Sambuc // Concatenation with period doesn't leave a space 66*f4a2713aSLionel Sambuc #define T8(A,B) A ## B 67*f4a2713aSLionel Sambuc 10: T8(.,T8) 68*f4a2713aSLionel Sambuc // CHECK-Identifiers-True: 10: .T8 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc // This should not crash. 71*f4a2713aSLionel Sambuc #define T11(a) #0 72*f4a2713aSLionel Sambuc 11: T11(b) 73*f4a2713aSLionel Sambuc // CHECK-Identifiers-True: 11: #0 74*f4a2713aSLionel Sambuc 75*f4a2713aSLionel Sambuc // Universal character names can specify basic ascii and control characters 76*f4a2713aSLionel Sambuc 12: \u0020\u0030\u0080\u0000 77*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: 12: \u0020\u0030\u0080\u0000 78*f4a2713aSLionel Sambuc 79*f4a2713aSLionel Sambuc // This should not crash 80*f4a2713aSLionel Sambuc // rdar://8823139 81*f4a2713aSLionel Sambuc # ## 82*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: # ## 83*f4a2713aSLionel Sambuc 84*f4a2713aSLionel Sambuc #define X(a) # # # 1 85*f4a2713aSLionel Sambuc X(1) 86*f4a2713aSLionel Sambuc // CHECK-Identifiers-False: # # # 1 87