1 // RUN: %clang_cc1 -no-opaque-pointers -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 -no-opaque-pointers -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
3 
4 // Base class has trivial dtor => complete dtor poisons base class memory directly.
5 
6 class Base {
7 public:
8   int x[4];
9 };
10 
11 class Derived : public Base {
12 public:
13   int y;
14   ~Derived() {
15   }
16 };
17 
18 Derived d;
19 
20 // Poison members, then poison the trivial base class.
21 // CHECK-LABEL: define {{.*}}DerivedD2Ev
22 // CHECK: %[[GEP:[0-9a-z]+]] = getelementptr i8, i8* {{.*}}, i64 16
23 // CHECK: call void @__sanitizer_dtor_callback{{.*}}%[[GEP]], i64 4
24 // CHECK: call void @__sanitizer_dtor_callback{{.*}}, i64 16
25 // CHECK: ret void
26