summaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/virtual-destructor-calls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGenCXX/virtual-destructor-calls.cpp')
-rw-r--r--clang/test/CodeGenCXX/virtual-destructor-calls.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/virtual-destructor-calls.cpp b/clang/test/CodeGenCXX/virtual-destructor-calls.cpp
new file mode 100644
index 0000000..1cc8bcc
--- /dev/null
+++ b/clang/test/CodeGenCXX/virtual-destructor-calls.cpp
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 -mconstructor-aliases | FileCheck %s
+
+struct Member {
+ ~Member();
+};
+
+struct A {
+ virtual ~A();
+};
+
+struct B : A {
+ Member m;
+ virtual ~B();
+};
+
+// Complete dtor: just an alias because there are no virtual bases.
+// CHECK: @_ZN1BD1Ev = alias {{.*}} @_ZN1BD2Ev
+
+// (aliases from C)
+// CHECK: @_ZN1CD1Ev = alias {{.*}} @_ZN1CD2Ev
+// CHECK: @_ZN1CD2Ev = alias bitcast {{.*}} @_ZN1BD2Ev
+
+// Deleting dtor: defers to the complete dtor.
+// CHECK: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr
+// CHECK: call void @_ZN1BD1Ev
+// CHECK: call void @_ZdlPv
+
+// Base dtor: actually calls A's base dtor.
+// CHECK: define void @_ZN1BD2Ev(%struct.B* %this) unnamed_addr
+// CHECK: call void @_ZN6MemberD1Ev
+// CHECK: call void @_ZN1AD2Ev
+
+B::~B() { }
+
+struct C : B {
+ ~C();
+};
+
+C::~C() { }
+
+// Complete dtor: just an alias (checked above).
+
+// Deleting dtor: defers to the complete dtor.
+// CHECK: define void @_ZN1CD0Ev(%struct.C* %this) unnamed_addr
+// CHECK: call void @_ZN1CD1Ev
+// CHECK: call void @_ZdlPv
+
+// Base dtor: just an alias to B's base dtor.