2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -x assembler-with-cpp -E %s -o - | FileCheck -strict-whitespace -check-prefix=CHECK-Identifiers-False %s
|
2008-12-02 03:23:47 +08:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
#error "__ASSEMBLER__ not defined"
|
|
|
|
#endif
|
2009-03-21 00:28:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Invalid token pasting is ok.
|
|
|
|
#define A X ## .
|
|
|
|
1: A
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-False: 1: X .
|
2009-03-21 00:28:22 +08:00
|
|
|
|
|
|
|
// Line markers are not linemarkers in .S files, they are passed through.
|
|
|
|
# 321
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-False: # 321
|
2009-03-21 00:28:22 +08:00
|
|
|
|
|
|
|
// Unknown directives are passed through.
|
|
|
|
# B C
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-False: # B C
|
2009-03-21 00:28:22 +08:00
|
|
|
|
|
|
|
// Unknown directives are expanded.
|
|
|
|
#define D(x) BAR ## x
|
|
|
|
# D(42)
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-False: # BAR42
|
2009-03-21 00:28:22 +08:00
|
|
|
|
|
|
|
// Unmatched quotes are permitted.
|
|
|
|
2: '
|
|
|
|
3: "
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-False: 2: '
|
|
|
|
// CHECK-Identifiers-False: 3: "
|
2009-03-21 00:28:22 +08:00
|
|
|
|
2009-05-23 05:35:34 +08:00
|
|
|
// (balance quotes to keep editors happy): "'
|
|
|
|
|
2009-03-21 00:28:22 +08:00
|
|
|
// Empty char literals are ok.
|
|
|
|
4: ''
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-False: 4: ''
|
2009-03-21 00:28:22 +08:00
|
|
|
|
2009-03-24 01:32:45 +08:00
|
|
|
|
|
|
|
// Portions of invalid pasting should still expand as macros.
|
|
|
|
// rdar://6709206
|
|
|
|
#define M4 expanded
|
2009-09-09 23:08:12 +08:00
|
|
|
#define M5() M4 ## (
|
2009-03-24 01:32:45 +08:00
|
|
|
|
|
|
|
5: M5()
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-False: 5: expanded (
|
2009-03-24 01:32:45 +08:00
|
|
|
|
2009-04-19 15:00:02 +08:00
|
|
|
// rdar://6804322
|
|
|
|
#define FOO(name) name ## $foo
|
|
|
|
6: FOO(blarg)
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-False: 6: blarg $foo
|
2009-04-19 15:00:02 +08:00
|
|
|
|
2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -x assembler-with-cpp -fdollars-in-identifiers -E %s -o - | FileCheck -check-prefix=CHECK-Identifiers-True -strict-whitespace %s
|
2009-04-19 15:00:02 +08:00
|
|
|
#define FOO(name) name ## $foo
|
|
|
|
7: FOO(blarg)
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-True: 7: blarg$foo
|
2009-03-24 01:32:45 +08:00
|
|
|
|
2009-05-23 05:35:34 +08:00
|
|
|
//
|
|
|
|
#define T6() T6 #nostring
|
|
|
|
#define T7(x) T7 #x
|
2009-05-26 01:16:10 +08:00
|
|
|
8: T6()
|
|
|
|
9: T7(foo)
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-True: 8: T6 #nostring
|
|
|
|
// CHECK-Identifiers-True: 9: T7 "foo"
|
2009-05-23 05:35:34 +08:00
|
|
|
|
2009-05-25 03:25:46 +08:00
|
|
|
// Concatenation with period doesn't leave a space
|
|
|
|
#define T8(A,B) A ## B
|
2009-05-26 01:16:10 +08:00
|
|
|
10: T8(.,T8)
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-True: 10: .T8
|
2009-05-26 01:16:10 +08:00
|
|
|
|
|
|
|
// This should not crash.
|
|
|
|
#define T11(a) #0
|
|
|
|
11: T11(b)
|
2009-10-27 11:47:36 +08:00
|
|
|
// CHECK-Identifiers-True: 11: #0
|
2009-05-25 03:25:46 +08:00
|
|
|
|
2013-10-21 13:02:28 +08:00
|
|
|
// Universal character names can specify basic ascii and control characters
|
|
|
|
12: \u0020\u0030\u0080\u0000
|
|
|
|
// CHECK-Identifiers-False: 12: \u0020\u0030\u0080\u0000
|
2011-01-06 13:01:51 +08:00
|
|
|
|
|
|
|
// This should not crash
|
|
|
|
// rdar://8823139
|
|
|
|
# ##
|
|
|
|
// CHECK-Identifiers-False: # ##
|
2013-06-19 05:33:38 +08:00
|
|
|
|
|
|
|
#define X(a) # # # 1
|
|
|
|
X(1)
|
|
|
|
// CHECK-Identifiers-False: # # # 1
|