blob: d64bd55aa0b9a604b7cac3dbd23a5e788c8a4ba1 [file] [log] [blame]
Leonard Chanf921d852018-06-04 16:07:52 +00001// RUN: %clang_cc1 -x c -ffixed-point -ast-dump %s | FileCheck %s --strict-whitespace
2
3/* Various contexts where type _Accum can appear. */
4
5// Primary fixed point types
6signed short _Accum s_short_accum;
7signed _Accum s_accum;
8signed long _Accum s_long_accum;
9unsigned short _Accum u_short_accum;
10unsigned _Accum u_accum;
11unsigned long _Accum u_long_accum;
12
13// Aliased fixed point types
14short _Accum short_accum;
15_Accum accum;
16long _Accum long_accum;
17
18// CHECK: |-VarDecl {{.*}} s_short_accum 'short _Accum'
19// CHECK-NEXT: |-VarDecl {{.*}} s_accum '_Accum'
20// CHECK-NEXT: |-VarDecl {{.*}} s_long_accum 'long _Accum'
21// CHECK-NEXT: |-VarDecl {{.*}} u_short_accum 'unsigned short _Accum'
22// CHECK-NEXT: |-VarDecl {{.*}} u_accum 'unsigned _Accum'
23// CHECK-NEXT: |-VarDecl {{.*}} u_long_accum 'unsigned long _Accum'
24// CHECK-NEXT: |-VarDecl {{.*}} short_accum 'short _Accum'
25// CHECK-NEXT: |-VarDecl {{.*}} accum '_Accum'
26// CHECK-NEXT: |-VarDecl {{.*}} long_accum 'long _Accum'
27
28#define MIX_TYPE_SPEC(SPEC, SIGN, SIZE, ID) \
29 SPEC SIGN SIZE _Accum ID; \
30 SIGN SPEC SIZE _Accum ID ## 2; \
31 SIGN SIZE SPEC _Accum ID ## 3; \
32 SIGN SIZE _Accum SPEC ID ## 4;
33
34/* Mixing fixed point types with other type specifiers */
35
36#define MIX_VOLATILE(SIGN, SIZE, ID) MIX_TYPE_SPEC(volatile, SIGN, SIZE, ID)
37#define MIX_ATOMIC(SIGN, SIZE, ID) MIX_TYPE_SPEC(_Atomic, SIGN, SIZE, ID)
38#define MIX_CONST(SIGN, SIZE, ID) MIX_TYPE_SPEC(const, SIGN, SIZE, ID)
39
40MIX_VOLATILE(signed, short, vol_s_short_accum)
41MIX_ATOMIC(signed, short, atm_s_short_accum)
42MIX_CONST(signed, short, const_s_short_accum)
43
44// CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum 'volatile short _Accum'
45// CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum2 'volatile short _Accum'
46// CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum3 'volatile short _Accum'
47// CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum4 'volatile short _Accum'
48
49// CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum '_Atomic(short _Accum)'
50// CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum2 '_Atomic(short _Accum)'
51// CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum3 '_Atomic(short _Accum)'
52// CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum4 '_Atomic(short _Accum)'
53
54// CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum 'const short _Accum'
55// CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum2 'const short _Accum'
56// CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum3 'const short _Accum'
57// CHECK-NEXT: `-VarDecl {{.*}} const_s_short_accum4 'const short _Accum'