150
|
1 // Test -fsanitize-memory-use-after-dtor
|
|
2 // RUN: %clang_cc1 -fsanitize=memory -O1 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
|
|
3 // RUN: %clang_cc1 -fsanitize=memory -O2 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
|
|
4
|
|
5 template <class T>
|
|
6 class Vector {
|
|
7 public:
|
|
8 int size;
|
|
9 ~Vector() {}
|
|
10 };
|
|
11
|
|
12 // Virtual function table for the derived class only contains
|
|
13 // its own destructors, with no aliasing to base class dtors.
|
|
14 struct Base {
|
|
15 Vector<int> v;
|
|
16 int x;
|
|
17 Base() { x = 5; }
|
|
18 virtual ~Base() {}
|
|
19 };
|
|
20
|
|
21 struct Derived : public Base {
|
|
22 int z;
|
|
23 Derived() { z = 10; }
|
|
24 ~Derived() {}
|
|
25 };
|
|
26
|
|
27 Derived d;
|
|
28
|
|
29 // Definition of virtual function table
|
|
30 // CHECK: @_ZTV7Derived = {{.*}}@_ZN7DerivedD1Ev{{.*}}@_ZN7DerivedD0Ev
|