1 // RUN: %clang_cc1 -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++20 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not "call void @__sanitizer_dtor_callback_fields"
2 // RUN: %clang_cc1 -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++20 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not "call void @__sanitizer_dtor_callback_fields"
6 struct EmptyNonTrivial
{
14 static_assert(sizeof(Trivial
) == 8);
21 static_assert(sizeof(NonTrivial
) == 8);
30 static_assert(sizeof(Struct
) == 16);
32 // CHECK-LABEL: define {{.*}} @_ZN2T06StructD2Ev(
33 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 13)
34 // CHECK-NEXT: ret void
44 static_assert(sizeof(Struct
) == 24);
46 // CHECK-LABEL: define {{.*}} @_ZN5empty2T16StructD2Ev(
47 // CHECK: [[GEP:%.+]] = getelementptr i8, {{.*}}, i64 8{{$}}
48 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr [[GEP]], i64 13)
49 // CHECK: call void @_ZN10NonTrivialD1Ev(
50 // CHECK-NEXT: ret void
59 static_assert(sizeof(Struct
) == 24);
61 // CHECK-LABEL: define {{.*}} @_ZN5empty2T26StructD2Ev(
62 // CHECK: [[GEP1:%.+]] = getelementptr i8, {{.*}}, i64 16{{$}}
63 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr [[GEP1]], i64 5)
64 // CHECK: call void @_ZN10NonTrivialD1Ev(
65 // CHECK: [[GEP2:%.+]] = getelementptr i8, {{.*}}, i64 0{{$}}
66 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr [[GEP2]], i64 8)
67 // CHECK-NEXT: ret void
76 static_assert(sizeof(Struct
) == 24);
78 // CHECK-LABEL: define {{.*}} @_ZN5empty2T36StructD2Ev(
79 // CHECK: [[GEP1:%.+]] = getelementptr i8, {{.*}}, i64 20{{$}}
80 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr [[GEP1]], i64 1)
81 // CHECK: call void @_ZN10NonTrivialD1Ev(
82 // CHECK: [[GEP2:%.+]] = getelementptr i8, {{.*}}, i64 0{{$}}
83 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr [[GEP2]], i64 12)
84 // CHECK-NEXT: ret void
93 static_assert(sizeof(Struct
) == 24);
95 // CHECK-LABEL: define {{.*}} @_ZN5empty2T46StructD2Ev(
96 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 16)
97 // CHECK-NEXT: ret void
101 [[no_unique_address
]] Empty e
;
107 static_assert(sizeof(Struct
) == 24);
109 // CHECK-LABEL: define {{.*}} @_ZN5empty2T56StructD2Ev(
110 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 13)
111 // CHECK: call void @_ZN10NonTrivialD1Ev(
112 // CHECK-NEXT: ret void
117 [[no_unique_address
]] Empty e
;
122 static_assert(sizeof(Struct
) == 24);
124 // CHECK-LABEL: define {{.*}} @_ZN5empty2T66StructD2Ev(
125 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 13)
126 // CHECK: call void @_ZN10NonTrivialD1Ev(
127 // CHECK-NEXT: ret void
133 [[no_unique_address
]] Empty e
;
137 static_assert(sizeof(Struct
) == 24);
139 // CHECK-LABEL: define {{.*}} @_ZN5empty2T76StructD2Ev(
140 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 5)
141 // CHECK: call void @_ZN10NonTrivialD1Ev(
142 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 8)
143 // CHECK-NEXT: ret void
148 [[no_unique_address
]] Empty e
;
153 static_assert(sizeof(Struct
) == 24);
155 // CHECK-LABEL: define {{.*}} @_ZN5empty2T86StructD2Ev(
156 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 5)
157 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 8)
158 // CHECK-NEXT: ret void
165 [[no_unique_address
]] Empty e
;
168 static_assert(sizeof(Struct
) == 24);
170 // CHECK-LABEL: define {{.*}} @_ZN5empty2T96StructD2Ev(
171 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 1)
172 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 12)
173 // CHECK-NEXT: ret void
179 [[no_unique_address
]] Empty e
;
183 static_assert(sizeof(Struct
) == 24);
185 // CHECK-LABEL: define {{.*}} @_ZN5empty3T106StructD2Ev(
186 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 1)
187 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 12)
188 // CHECK-NEXT: ret void
196 [[no_unique_address
]] Empty e
;
198 static_assert(sizeof(Struct
) == 24);
200 // CHECK-LABEL: define {{.*}} @_ZN5empty3T116StructD2Ev(
201 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 16)
202 // CHECK-NEXT: ret void
209 [[no_unique_address
]] Empty e
;
212 static_assert(sizeof(Struct
) == 24);
215 // CHECK-LABEL: define {{.*}} @_ZN5empty3T126StructD2Ev(
216 // CHECK: call void @_ZN10NonTrivialD1Ev(
217 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 16)
218 // CHECK-NEXT: ret void
220 namespace empty_non_trivial
{
228 static_assert(sizeof(Struct
) == 24);
230 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial2T16StructD2Ev(
231 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 13)
232 // CHECK: call void @_ZN10NonTrivialD1Ev(
233 // CHECK-NEXT: ret void
242 static_assert(sizeof(Struct
) == 24);
244 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial2T26StructD2Ev(
245 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 5)
246 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 8)
247 // CHECK-NEXT: ret void
256 static_assert(sizeof(Struct
) == 24);
258 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial2T36StructD2Ev(
259 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 1)
260 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 12)
261 // CHECK-NEXT: ret void
270 static_assert(sizeof(Struct
) == 24);
272 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial2T46StructD2Ev(
273 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 16)
274 // CHECK-NEXT: ret void
278 [[no_unique_address
]] EmptyNonTrivial e
;
284 static_assert(sizeof(Struct
) == 24);
286 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial2T56StructD2Ev(
287 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 13)
288 // CHECK: call void @_ZN10NonTrivialD1Ev(
289 // CHECK: call void @_ZN15EmptyNonTrivialD1Ev(
290 // CHECK-NEXT: ret void
295 [[no_unique_address
]] EmptyNonTrivial e
;
300 static_assert(sizeof(Struct
) == 24);
302 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial2T66StructD2Ev(
303 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 13)
304 // CHECK: call void @_ZN15EmptyNonTrivialD1Ev(
305 // CHECK: call void @_ZN10NonTrivialD1Ev(
306 // CHECK-NEXT: ret void
312 [[no_unique_address
]] EmptyNonTrivial e
;
316 static_assert(sizeof(Struct
) == 24);
318 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial2T76StructD2Ev(
319 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 5)
320 // CHECK: call void @_ZN15EmptyNonTrivialD1Ev(
321 // CHECK: call void @_ZN10NonTrivialD1Ev(
322 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 8)
323 // CHECK-NEXT: ret void
328 [[no_unique_address
]] EmptyNonTrivial e
;
333 static_assert(sizeof(Struct
) == 24);
335 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial2T86StructD2Ev(
336 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 5)
337 // CHECK: call void @_ZN10NonTrivialD1Ev(
338 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 8)
339 // CHECK: call void @_ZN15EmptyNonTrivialD1Ev(
340 // CHECK-NEXT: ret void
347 [[no_unique_address
]] EmptyNonTrivial e
;
350 static_assert(sizeof(Struct
) == 24);
352 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial2T96StructD2Ev(
353 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 1)
354 // CHECK: call void @_ZN15EmptyNonTrivialD1Ev(
355 // CHECK: call void @_ZN10NonTrivialD1Ev(
356 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 12)
357 // CHECK-NEXT: ret void
363 [[no_unique_address
]] EmptyNonTrivial e
;
367 static_assert(sizeof(Struct
) == 24);
369 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial3T106StructD2Ev(
370 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 1)
371 // CHECK: call void @_ZN10NonTrivialD1Ev(
372 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 12)
373 // CHECK: call void @_ZN15EmptyNonTrivialD1Ev(
374 // CHECK-NEXT: ret void
382 [[no_unique_address
]] EmptyNonTrivial e
;
384 static_assert(sizeof(Struct
) == 24);
386 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial3T116StructD2Ev(
387 // CHECK: call void @_ZN15EmptyNonTrivialD1Ev(
388 // CHECK: call void @_ZN10NonTrivialD1Ev(
389 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 16)
390 // CHECK-NEXT: ret void
397 [[no_unique_address
]] EmptyNonTrivial e
;
400 static_assert(sizeof(Struct
) == 24);
402 } // namespace empty_non_trivial
403 // CHECK-LABEL: define {{.*}} @_ZN17empty_non_trivial3T126StructD2Ev(
404 // CHECK: call void @_ZN10NonTrivialD1Ev(
405 // CHECK: call void @__sanitizer_dtor_callback_fields(ptr {{.*}}, i64 16)
406 // CHECK: call void @_ZN15EmptyNonTrivialD1Ev(