1 // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
2 // RUN: -fsyntax-only -fxl-pragma-pack -x c %s | \
3 // RUN: FileCheck --check-prefixes=CHECK,CHECK32 %s
4 // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
5 // RUN: -fsyntax-only -fxl-pragma-pack -x c++ %s | \
6 // RUN: FileCheck --check-prefixes=CHECK,CHECK32 %s
8 // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
9 // RUN: -fsyntax-only -fxl-pragma-pack -x c %s | \
10 // RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s
11 // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
12 // RUN: -fsyntax-only -fxl-pragma-pack -x c++ %s | \
13 // RUN: FileCheck --check-prefixes=CHECK,CHECK64 %s
21 // CHECK: *** Dumping AST Record Layout
22 // CHECK-NEXT: 0 | struct A
23 // CHECK-NEXT: 0:0-1 | unsigned char c
24 // CHECK-NEXT: sizeof=4, {{(dsize=4, )?}}align=4, preferredalign=4
33 // CHECK: *** Dumping AST Record Layout
34 // CHECK-NEXT: 0 | struct B
35 // CHECK-NEXT: 0 | char c
36 // CHECK-NEXT: 4:- | int
37 // CHECK-NEXT: sizeof=4, {{(dsize=4, )?}}align=4, preferredalign=4
51 // CHECK: *** Dumping AST Record Layout
52 // CHECK-NEXT: 0 | struct C
53 // CHECK-NEXT: 0:0-5 | int a1
54 // CHECK-NEXT: 0:6-9 | signed char a2
55 // CHECK-NEXT: 1:2-3 | short a3
56 // CHECK-NEXT: 1:4-5 | int a4
57 // CHECK-NEXT: 1:6-10 | long a5
58 // CHECK-NEXT: 2:3-8 | long long a6
59 // CHECK32: 4:0-7 | unsigned long a7
60 // CHECK32: sizeof=8, {{(dsize=8, )?}}align=4, preferredalign=4
61 // CHECK64: 3:1-8 | unsigned long a7
62 // CHECK64: sizeof=8, {{(dsize=8, )?}}align=8, preferredalign=8
78 // CHECK: *** Dumping AST Record Layout
79 // CHECK-NEXT: 0 | struct C1
80 // CHECK-NEXT: 0:0-5 | int a1
81 // CHECK-NEXT: 0:6-9 | signed char a2
82 // CHECK-NEXT: 1:2-3 | short a3
83 // CHECK-NEXT: 1:4-5 | int a4
84 // CHECK-NEXT: 1:6-10 | long a5
85 // CHECK-NEXT: 2:3-8 | long long a6
86 // CHECK-NEXT: 3:1-8 | unsigned long a7
87 // CHECK-NEXT: sizeof=5, {{(dsize=5, )?}}align=1, preferredalign=1
103 // CHECK: *** Dumping AST Record Layout
104 // CHECK-NEXT: 0 | struct C2
105 // CHECK-NEXT: 0:0-5 | int a1
106 // CHECK-NEXT: 0:6-9 | signed char a2
107 // CHECK-NEXT: 1:2-3 | short a3
108 // CHECK-NEXT: 1:4-5 | int a4
109 // CHECK-NEXT: 1:6-10 | long a5
110 // CHECK-NEXT: 2:3-8 | long long a6
111 // CHECK-NEXT: 3:1-8 | unsigned long a7
112 // CHECK-NEXT: sizeof=8, {{(dsize=8, )?}}align=4, preferredalign=4
114 typedef __attribute__((aligned(32))) short mySHORT
;
122 // CHECK: *** Dumping AST Record Layout
123 // CHECK-NEXT: 0 | struct D
124 // CHECK-NEXT: 0:0-7 | char c
125 // CHECK-NEXT: 32:- | mySHORT
126 // CHECK-NEXT: sizeof=32, {{(dsize=32, )?}}align=32, preferredalign=32
128 typedef __attribute__((aligned(32))) long myLONG
;
134 int d11
= sizeof(D11
);
136 // CHECK: *** Dumping AST Record Layout
137 // CHECK-NEXT: 0 | struct D11
138 // CHECK-NEXT: 0:0-7 | char c
139 // CHECK-NEXT: 32:- | myLONG
140 // CHECK-NEXT: sizeof=32, {{(dsize=32, )?}}align=32, preferredalign=32
142 typedef __attribute__((aligned(2))) long myLONG2
;
148 int d12
= sizeof(D12
);
150 // CHECK: *** Dumping AST Record Layout
151 // CHECK-NEXT: 0 | struct D12
152 // CHECK-NEXT: 0:0-7 | char c
153 // CHECK32: 4:- | myLONG2
154 // CHECK32: sizeof=4, {{(dsize=4, )?}}align=4, preferredalign=4
155 // CHECK64: 8:- | myLONG2
156 // CHECK64: sizeof=8, {{(dsize=8, )?}}align=8, preferredalign=8
158 typedef __attribute__((aligned(32))) long long myLONGLONG
;
164 int d21
= sizeof(D21
);
166 // CHECK: *** Dumping AST Record Layout
167 // CHECK-NEXT: 0 | struct D21
168 // CHECK-NEXT: 0:0-7 | char c
169 // CHECK-NEXT: 32:- | myLONGLONG
170 // CHECK-NEXT: sizeof=32, {{(dsize=32, )?}}align=32, preferredalign=32
172 typedef __attribute__((aligned(2))) long long myLONGLONG2
;
178 int d22
= sizeof(D22
);
180 // CHECK: *** Dumping AST Record Layout
181 // CHECK-NEXT: 0 | struct D22
182 // CHECK-NEXT: 0:0-7 | char c
183 // CHECK32: 4:- | myLONGLONG2
184 // CHECK32: sizeof=4, {{(dsize=4, )?}}align=4, preferredalign=4
185 // CHECK64: 8:- | myLONGLONG2
186 // CHECK64: sizeof=8, {{(dsize=8, )?}}align=8, preferredalign=8
188 enum LL
: unsigned long long { val
= 1 };
196 // CHECK: *** Dumping AST Record Layout
197 // CHECK-NEXT: 0 | struct E
198 // CHECK-NEXT: 0:0-31 | enum LL e
199 // CHECK32-NEXT: sizeof=4, {{(dsize=4, )?}}align=4, preferredalign=4
200 // CHECK64-NEXT: sizeof=8, {{(dsize=8, )?}}align=8, preferredalign=8
202 enum LL1
: unsigned long long { val1
= 1 } __attribute__((aligned(16)));
209 // CHECK: *** Dumping AST Record Layout
210 // CHECK-NEXT: 0 | struct E1
211 // CHECK-NEXT: 0:0-31 | enum LL1 e
212 // CHECK-NEXT: sizeof=16, {{(dsize=16, )?}}align=16, preferredalign=16
215 long long l
: 32 __attribute__((aligned(16)));
220 // CHECK: *** Dumping AST Record Layout
221 // CHECK-NEXT: 0 | struct F
222 // CHECK-NEXT: 0:0-31 | long long l
223 // CHECK-NEXT: sizeof=16, {{(dsize=16, )?}}align=16, preferredalign=16
231 // CHECK: *** Dumping AST Record Layout
232 // CHECK-NEXT: 0 | struct G
233 // CHECK-NEXT: 0:0-44 | long long ll
234 // CHECK-NEXT: sizeof=8, {{(dsize=8, )?}}align=8, preferredalign=8
236 #pragma align(packed)
246 // CHECK: *** Dumping AST Record Layout
247 // CHECK-NEXT: 0 | struct H
248 // CHECK-NEXT: 0 | char c
249 // CHECK-NEXT: 4:- | int
250 // CHECK-NEXT: 4 | int i
251 // CHECK-NEXT: sizeof=8, {{(dsize=8, )?}}align=1, preferredalign=1
263 // CHECK: *** Dumping AST Record Layout
264 // CHECK-NEXT: 0 | struct I
265 // CHECK-NEXT: 0 | char c
266 // CHECK-NEXT: 4:- | int
267 // CHECK-NEXT: 4 | int i
268 // CHECK-NEXT: sizeof=8, {{(dsize=8, )?}}align=2, preferredalign=2