llvm-project
158 строк · 4.7 Кб
1// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
2// RUN: -fsyntax-only %s | \
3// RUN: FileCheck %s
4
5// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
6// RUN: -fsyntax-only %s | \
7// RUN: FileCheck %s
8
9struct Empty {};10
11struct A {12double d;13};14
15// CHECK: *** Dumping AST Record Layout
16// CHECK-NEXT: 0 | struct Empty (empty)
17// CHECK-NEXT: | [sizeof=1, dsize=1, align=1, preferredalign=1,
18// CHECK-NEXT: | nvsize=1, nvalign=1, preferrednvalign=1]
19
20// CHECK: *** Dumping AST Record Layout
21// CHECK-NEXT: 0 | struct A
22// CHECK-NEXT: 0 | double d
23// CHECK-NEXT: | [sizeof=8, dsize=8, align=4, preferredalign=8,
24// CHECK-NEXT: | nvsize=8, nvalign=4, preferrednvalign=8]
25
26struct B {27~B();28
29Empty emp;30A a;31char c;32};33
34struct B1 {35[[no_unique_address]] B b;36char ext[7];37};38
39// CHECK: *** Dumping AST Record Layout
40// CHECK-NEXT: 0 | struct B
41// CHECK-NEXT: 0 | struct Empty emp (empty)
42// CHECK-NEXT: 4 | struct A a
43// CHECK-NEXT: 4 | double d
44// CHECK-NEXT: 12 | char c
45// CHECK-NEXT: | [sizeof=16, dsize=13, align=4, preferredalign=4,
46// CHECK-NEXT: | nvsize=13, nvalign=4, preferrednvalign=4]
47
48// CHECK: *** Dumping AST Record Layout
49// CHECK-NEXT: 0 | struct B1
50// CHECK-NEXT: 0 | struct B b
51// CHECK-NEXT: 0 | struct Empty emp (empty)
52// CHECK-NEXT: 4 | struct A a
53// CHECK-NEXT: 4 | double d
54// CHECK-NEXT: 12 | char c
55// CHECK-NEXT: 13 | char[7] ext
56// CHECK-NEXT: | [sizeof=20, dsize=20, align=4, preferredalign=4,
57// CHECK-NEXT: | nvsize=20, nvalign=4, preferrednvalign=4]
58
59struct C {60~C();61
62[[no_unique_address]] Empty emp;63A a;64char c;65};66
67struct C1 {68[[no_unique_address]] C c;69char ext[7];70};71
72// CHECK: *** Dumping AST Record Layout
73// CHECK-NEXT: 0 | struct C
74// CHECK-NEXT: 0 | struct Empty emp (empty)
75// CHECK-NEXT: 0 | struct A a
76// CHECK-NEXT: 0 | double d
77// CHECK-NEXT: 8 | char c
78// CHECK-NEXT: | [sizeof=16, dsize=9, align=4, preferredalign=8,
79// CHECK-NEXT: | nvsize=9, nvalign=4, preferrednvalign=8]
80
81// CHECK: *** Dumping AST Record Layout
82// CHECK-NEXT: 0 | struct C1
83// CHECK-NEXT: 0 | struct C c
84// CHECK-NEXT: 0 | struct Empty emp (empty)
85// CHECK-NEXT: 0 | struct A a
86// CHECK-NEXT: 0 | double d
87// CHECK-NEXT: 8 | char c
88// CHECK-NEXT: 9 | char[7] ext
89// CHECK-NEXT: | [sizeof=16, dsize=16, align=4, preferredalign=8,
90// CHECK-NEXT: | nvsize=16, nvalign=4, preferrednvalign=8]
91
92struct D {93~D();94
95[[no_unique_address]] char notEmp;96A a;97char c;98};99
100struct D1 {101[[no_unique_address]] D d;102char ext[7];103};104
105// CHECK: *** Dumping AST Record Layout
106// CHECK-NEXT: 0 | struct D
107// CHECK-NEXT: 0 | char notEmp
108// CHECK-NEXT: 4 | struct A a
109// CHECK-NEXT: 4 | double d
110// CHECK-NEXT: 12 | char c
111// CHECK-NEXT: | [sizeof=16, dsize=13, align=4, preferredalign=4,
112// CHECK-NEXT: | nvsize=13, nvalign=4, preferrednvalign=4]
113
114// CHECK: *** Dumping AST Record Layout
115// CHECK-NEXT: 0 | struct D1
116// CHECK-NEXT: 0 | struct D d
117// CHECK-NEXT: 0 | char notEmp
118// CHECK-NEXT: 4 | struct A a
119// CHECK-NEXT: 4 | double d
120// CHECK-NEXT: 12 | char c
121// CHECK-NEXT: 13 | char[7] ext
122// CHECK-NEXT: | [sizeof=20, dsize=20, align=4, preferredalign=4,
123// CHECK-NEXT: | nvsize=20, nvalign=4, preferrednvalign=4]
124
125struct E {126[[no_unique_address]] Empty emp;127int : 0;128double d;129};130
131// CHECK: *** Dumping AST Record Layout
132// CHECK-NEXT: 0 | struct E
133// CHECK-NEXT: 0 | struct Empty emp (empty)
134// CHECK-NEXT: 0:- | int
135// CHECK-NEXT: 0 | double d
136// CHECK-NEXT: | [sizeof=8, dsize=8, align=4, preferredalign=4,
137// CHECK-NEXT: | nvsize=8, nvalign=4, preferrednvalign=4]
138
139struct F {140[[no_unique_address]] Empty emp, emp2;141double d;142};143
144// CHECK: *** Dumping AST Record Layout
145// CHECK-NEXT: 0 | struct F
146// CHECK-NEXT: 0 | struct Empty emp (empty)
147// CHECK-NEXT: 1 | struct Empty emp2 (empty)
148// CHECK-NEXT: 0 | double d
149// CHECK-NEXT: | [sizeof=8, dsize=8, align=4, preferredalign=8,
150// CHECK-NEXT: | nvsize=8, nvalign=4, preferrednvalign=8]
151
152int a = sizeof(Empty);153int b = sizeof(A);154int c = sizeof(B1);155int d = sizeof(C1);156int e = sizeof(D1);157int f = sizeof(E);158int g = sizeof(F);159