Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Layout / aix-power-natural-interaction.cpp
blobfe917f3e2c06a10eab455f3eac6be9e948113a78
1 // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
2 // RUN: -fxl-pragma-pack -fsyntax-only %s | \
3 // RUN: FileCheck %s
5 // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
6 // RUN: -fxl-pragma-pack -fsyntax-only %s | \
7 // RUN: FileCheck %s
9 namespace test1 {
10 #pragma align(natural)
11 struct A {
12 int i1;
15 struct B {
16 double d1;
18 #pragma align(reset)
20 struct C : A, B {
21 double d2;
24 int a = sizeof(C);
26 // CHECK: *** Dumping AST Record Layout
27 // CHECK-NEXT: 0 | struct test1::A
28 // CHECK-NEXT: 0 | int i1
29 // CHECK-NEXT: | [sizeof=4, dsize=4, align=4, preferredalign=4,
30 // CHECK-NEXT: | nvsize=4, nvalign=4, preferrednvalign=4]
32 // CHECK: *** Dumping AST Record Layout
33 // CHECK-NEXT: 0 | struct test1::B
34 // CHECK-NEXT: 0 | double d1
35 // CHECK-NEXT: | [sizeof=8, dsize=8, align=4, preferredalign=8,
36 // CHECK-NEXT: | nvsize=8, nvalign=4, preferrednvalign=8]
38 // CHECK: *** Dumping AST Record Layout
39 // CHECK-NEXT: 0 | struct test1::C
40 // CHECK-NEXT: 0 | struct test1::A (base)
41 // CHECK-NEXT: 0 | int i1
42 // CHECK-NEXT: 4 | struct test1::B (base)
43 // CHECK-NEXT: 4 | double d1
44 // CHECK-NEXT: 12 | double d2
45 // CHECK-NEXT: | [sizeof=20, dsize=20, align=4, preferredalign=4,
46 // CHECK-NEXT: | nvsize=20, nvalign=4, preferrednvalign=4]
48 } // namespace test1
50 namespace test2 {
51 struct A {
52 int i1;
53 double d;
56 #pragma align(natural)
57 struct B : A {
58 int i2;
60 #pragma align(reset)
62 int b = sizeof(B);
64 // CHECK: *** Dumping AST Record Layout
65 // CHECK-NEXT: 0 | struct test2::A
66 // CHECK-NEXT: 0 | int i1
67 // CHECK-NEXT: 4 | double d
68 // CHECK-NEXT: | [sizeof=12, dsize=12, align=4, preferredalign=4,
69 // CHECK-NEXT: | nvsize=12, nvalign=4, preferrednvalign=4]
71 // CHECK: *** Dumping AST Record Layout
72 // CHECK-NEXT: 0 | struct test2::B
73 // CHECK-NEXT: 0 | struct test2::A (base)
74 // CHECK-NEXT: 0 | int i1
75 // CHECK-NEXT: 4 | double d
76 // CHECK-NEXT: 12 | int i2
77 // CHECK-NEXT: | [sizeof=16, dsize=16, align=4, preferredalign=4,
78 // CHECK-NEXT: | nvsize=16, nvalign=4, preferrednvalign=4]
80 } // namespace test2
82 namespace test3 {
83 #pragma align(natural)
84 struct A {
85 int i1;
86 double d;
88 #pragma align(reset)
90 struct B {
91 struct A a;
92 int i2;
95 int c = sizeof(B);
97 // CHECK: *** Dumping AST Record Layout
98 // CHECK-NEXT: 0 | struct test3::A
99 // CHECK-NEXT: 0 | int i1
100 // CHECK-NEXT: 8 | double d
101 // CHECK-NEXT: | [sizeof=16, dsize=16, align=4, preferredalign=8,
102 // CHECK-NEXT: | nvsize=16, nvalign=4, preferrednvalign=8]
104 // CHECK: *** Dumping AST Record Layout
105 // CHECK-NEXT: 0 | struct test3::B
106 // CHECK-NEXT: 0 | struct test3::A a
107 // CHECK-NEXT: 0 | int i1
108 // CHECK-NEXT: 8 | double d
109 // CHECK-NEXT: 16 | int i2
110 // CHECK-NEXT: | [sizeof=24, dsize=24, align=4, preferredalign=8,
111 // CHECK-NEXT: | nvsize=24, nvalign=4, preferrednvalign=8]
113 } // namespace test3
115 namespace test4 {
116 struct A {
117 int i1;
118 double d;
121 #pragma align(natural)
122 struct B {
123 int i2;
124 struct A a;
126 #pragma align(reset)
128 int d = sizeof(B);
130 // CHECK: *** Dumping AST Record Layout
131 // CHECK-NEXT: 0 | struct test4::A
132 // CHECK-NEXT: 0 | int i1
133 // CHECK-NEXT: 4 | double d
134 // CHECK-NEXT: | [sizeof=12, dsize=12, align=4, preferredalign=4,
135 // CHECK-NEXT: | nvsize=12, nvalign=4, preferrednvalign=4]
137 // CHECK: *** Dumping AST Record Layout
138 // CHECK-NEXT: 0 | struct test4::B
139 // CHECK-NEXT: 0 | int i2
140 // CHECK-NEXT: 4 | struct test4::A a
141 // CHECK-NEXT: 4 | int i1
142 // CHECK-NEXT: 8 | double d
143 // CHECK-NEXT: | [sizeof=16, dsize=16, align=4, preferredalign=4,
144 // CHECK-NEXT: | nvsize=16, nvalign=4, preferrednvalign=4]
146 } // namespace test4