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,32BIT %s
5 // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
6 // RUN: -fsyntax-only -fxl-pragma-pack -x c++ %s | \
7 // RUN: FileCheck --check-prefixes=CHECK,32BIT %s
9 // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
10 // RUN: -fsyntax-only -fxl-pragma-pack -x c %s | \
11 // RUN: FileCheck --check-prefixes=CHECK,64BIT %s
13 // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
14 // RUN: -fsyntax-only -fxl-pragma-pack -x c++ %s | \
15 // RUN: FileCheck --check-prefixes=CHECK,64BIT %s
23 int a
= sizeof(struct A
);
25 // CHECK: *** Dumping AST Record Layout
26 // CHECK-NEXT: 0 | struct A
27 // CHECK-NEXT: 0:0-29 | int a1
28 // CHECK-NEXT: 4:0-29 | int a2
29 // CHECK-NEXT: 8:0-3 | int a3
30 // CHECK-NEXT: sizeof=12, {{(dsize=12, )?}}align=4, preferredalign=4
40 int b
= sizeof(struct AlignPacked
);
42 // CHECK: *** Dumping AST Record Layout
43 // CHECK-NEXT: 0 | struct AlignPacked
44 // CHECK-NEXT: 0:0-29 | int a1
45 // CHECK-NEXT: 3:6-35 | int a2
46 // CHECK-NEXT: 7:4-7 | int a3
47 // CHECK-NEXT: sizeof=8, {{(dsize=8, )?}}align=1, preferredalign=1
57 int c
= sizeof(struct Pack1
);
59 // CHECK: *** Dumping AST Record Layout
60 // CHECK-NEXT: 0 | struct Pack1
61 // CHECK-NEXT: 0:0-29 | int a1
62 // CHECK-NEXT: 3:6-35 | int a2
63 // CHECK-NEXT: 7:4-7 | int a3
64 // CHECK-NEXT: sizeof=8, {{(dsize=8, )?}}align=1, preferredalign=1
74 int d
= sizeof(struct Pack2
);
76 // CHECK: *** Dumping AST Record Layout
77 // CHECK-NEXT: 0 | struct Pack2
78 // CHECK-NEXT: 0:0-29 | int a1
79 // CHECK-NEXT: 3:6-35 | int a2
80 // CHECK-NEXT: 7:4-7 | int a3
81 // CHECK-NEXT: sizeof=8, {{(dsize=8, )?}}align=2, preferredalign=2
83 struct __attribute__((packed
)) PackedAttr
{
90 int e
= sizeof(struct PackedAttr
);
91 // CHECK: *** Dumping AST Record Layout
92 // CHECK-NEXT: 0 | struct PackedAttr
93 // CHECK-NEXT: 0 | char f1
94 // CHECK-NEXT: 4:- | int
95 // CHECK-NEXT: 4:0-2 | short
96 // CHECK-NEXT: 4:3-4 | char f4
97 // CHECK-NEXT: sizeof=5, {{(dsize=5, )?}}align=1, preferredalign=1
100 struct __attribute__((packed
)) PackedAttrAndPragma
{
106 int f
= sizeof(struct PackedAttrAndPragma
);
107 // CHECK: *** Dumping AST Record Layout
108 // CHECK-NEXT: 0 | struct PackedAttrAndPragma
109 // CHECK-NEXT: 0 | char f1
110 // 32BIT-NEXT: 4:- | long long
111 // 32BIT-NEXT: sizeof=4, {{(dsize=4, )?}}align=1, preferredalign=1
112 // 64BIT-NEXT: 8:- | long long
113 // 64BIT-NEXT: sizeof=8, {{(dsize=8, )?}}align=1, preferredalign=1