llvm-project

Форк
0
/
aix-no-unique-address-with-double.cpp 
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

9
struct Empty {};
10

11
struct A {
12
  double 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

26
struct B {
27
  ~B();
28

29
  Empty emp;
30
  A a;
31
  char c;
32
};
33

34
struct B1 {
35
  [[no_unique_address]] B b;
36
  char 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

59
struct C {
60
  ~C();
61

62
  [[no_unique_address]] Empty emp;
63
  A a;
64
  char c;
65
};
66

67
struct C1 {
68
  [[no_unique_address]] C c;
69
  char 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

92
struct D {
93
  ~D();
94

95
  [[no_unique_address]] char notEmp;
96
  A a;
97
  char c;
98
};
99

100
struct D1 {
101
  [[no_unique_address]] D d;
102
  char 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

125
struct E {
126
  [[no_unique_address]] Empty emp;
127
  int : 0;
128
  double 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

139
struct F {
140
  [[no_unique_address]] Empty emp, emp2;
141
  double 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

152
int a = sizeof(Empty);
153
int b = sizeof(A);
154
int c = sizeof(B1);
155
int d = sizeof(C1);
156
int e = sizeof(D1);
157
int f = sizeof(E);
158
int g = sizeof(F);
159

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.