1 // RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
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 -o - %s | FileCheck %s
4 // Base dtor poisons members
5 // Complete dtor poisons vtable ptr after destroying members and
19 class Derived
: public Base
{
32 // Invoke base destructor. No vtable pointer to poison.
33 // CHECK-LABEL: define {{.*}}DerivedD1Ev
34 // CHECK-NOT: call void @__sanitizer_dtor_callback
35 // CHECK: call void {{.*}}DerivedD2Ev
36 // CHECK-NOT: call void @__sanitizer_dtor_callback
39 // CHECK-LABEL: define {{.*}}DerivedD0Ev
40 // CHECK-NOT: call void @__sanitizer_dtor_callback
41 // CHECK: call void {{.*}}DerivedD1Ev
42 // CHECK-NOT: call void @__sanitizer_dtor_callback
45 // Invokes base destructor, and poison vtable pointer.
46 // CHECK-LABEL: define {{.*}}BaseD1Ev
47 // CHECK-NOT: call void @__sanitizer_dtor_callback
48 // CHECK: call void {{.*}}BaseD2Ev
49 // CHECK-NOT: call void @__sanitizer_dtor_callback
52 // CHECK-LABEL: define {{.*}}BaseD0Ev
53 // CHECK-NOT: call void @__sanitizer_dtor_callback
54 // CHECK: call void {{.*}}BaseD1Ev
55 // CHECK-NOT: call void @__sanitizer_dtor_callback
58 // Poison members and vtable ptr.
59 // CHECK-LABEL: define {{.*}}BaseD2Ev
60 // CHECK: call void @__sanitizer_dtor_callback
61 // CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8
62 // CHECK-NOT: call void @__sanitizer_dtor_callback
65 // Poison members and destroy non-virtual base.
66 // CHECK-LABEL: define {{.*}}DerivedD2Ev
67 // CHECK: call void @__sanitizer_dtor_callback
68 // CHECK-NOT: call void @__sanitizer_dtor_callback
69 // CHECK: call void {{.*}}BaseD2Ev
70 // CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8