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