Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / sanitize-dtor-trivial-base.cpp
blobc4062cff3d19f5eb70dbf5ab868168b77bf8c237
1 // RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -debug-info-kind=line-tables-only -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
2 // RUN: %clang_cc1 -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -debug-info-kind=line-tables-only -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
4 // Base class has trivial dtor => complete dtor poisons base class memory directly.
6 class Base {
7 public:
8 int x[4];
9 };
11 class Derived : public Base {
12 public:
13 int y;
14 ~Derived() {
18 Derived d;
20 // Poison members, then poison the trivial base class.
21 // CHECK-LABEL: define {{.*}}DerivedD2Ev
22 // CHECK: %[[GEP:[0-9a-z]+]] = getelementptr i8, ptr {{.*}}, i64 16
23 // CHECK: call void @__sanitizer_dtor_callback_fields({{.*}}%[[GEP]], i64 4{{.*}}, !dbg ![[DI1:[0-9]+]]
24 // CHECK: call void @__sanitizer_dtor_callback_fields({{.*}}, i64 16{{.*}}, !dbg ![[DI2:[0-9]+]]
25 // CHECK: ret void
27 // CHECK-LABEL: !DIFile{{.*}}cpp
29 // CHECK-DAG: ![[DI1]] = {{.*}}line: [[@LINE-16]]
30 // CHECK-DAG: ![[DI2]] = {{.*}}line: [[@LINE-24]]