summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-05-15 17:36:21 +0000
committerAnders Carlsson <andersca@mac.com>2011-05-15 17:36:21 +0000
commit49c0bd2a251c851640b67d5f5de2b3ee598b640c (patch)
tree09de11a2434b62c54ebffcd6833b6c17d9eefbaa /clang/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp
parent2f10078ae74db714f605a808a64e845a78877d6b (diff)
downloadbcm5719-llvm-49c0bd2a251c851640b67d5f5de2b3ee598b640c.tar.gz
bcm5719-llvm-49c0bd2a251c851640b67d5f5de2b3ee598b640c.zip
Re-enable the fix for PR9181 now that all the edge cases are handled.
llvm-svn: 131385
Diffstat (limited to 'clang/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp')
-rw-r--r--clang/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp83
1 files changed, 81 insertions, 2 deletions
diff --git a/clang/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp b/clang/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp
index 3b70ec03a34..3520b912cf9 100644
--- a/clang/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp
+++ b/clang/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
-// XFAIL: *
namespace Test1 {
@@ -104,4 +103,84 @@ A::~A()
{
}
-} \ No newline at end of file
+}
+
+namespace Test6 {
+
+// Check that we do initialize the vtable pointer in A::~A(), since Field has a member
+// variable with a non-trivial destructor body.
+
+struct NonTrivialDestructorBody {
+ ~NonTrivialDestructorBody();
+};
+
+struct Field {
+ NonTrivialDestructorBody nonTrivialDestructorBody;
+};
+
+struct A {
+ virtual void f();
+ ~A();
+
+ Field field;
+};
+
+// CHECK: define void @_ZN5Test61AD2Ev
+// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTVN5Test61AE, i64 0, i64 2), i8***
+A::~A()
+{
+}
+
+}
+
+namespace Test7 {
+
+// Check that we do initialize the vtable pointer in A::~A(), since Field has a base
+// class with a non-trivial destructor body.
+
+struct NonTrivialDestructorBody {
+ ~NonTrivialDestructorBody();
+};
+
+struct Field : NonTrivialDestructorBody { };
+
+struct A {
+ virtual void f();
+ ~A();
+
+ Field field;
+};
+
+// CHECK: define void @_ZN5Test71AD2Ev
+// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTVN5Test71AE, i64 0, i64 2), i8***
+A::~A()
+{
+}
+
+}
+
+namespace Test8 {
+
+// Check that we do initialize the vtable pointer in A::~A(), since Field has a virtual base
+// class with a non-trivial destructor body.
+
+struct NonTrivialDestructorBody {
+ ~NonTrivialDestructorBody();
+};
+
+struct Field : virtual NonTrivialDestructorBody { };
+
+struct A {
+ virtual void f();
+ ~A();
+
+ Field field;
+};
+
+// CHECK: define void @_ZN5Test81AD2Ev
+// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTVN5Test81AE, i64 0, i64 2), i8***
+A::~A()
+{
+}
+
+}
OpenPOWER on IntegriCloud