From adf5dc340db3ea99de5fe3f6c42cfee1807d445e Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 15 May 2011 17:36:21 +0000 Subject: Re-enable the fix for PR9181 now that all the edge cases are handled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131385 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../skip-vtable-pointer-initialization.cpp | 83 +++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) (limited to 'test/CodeGenCXX/skip-vtable-pointer-initialization.cpp') diff --git a/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp b/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp index 3b70ec03a3..3520b912cf 100644 --- a/test/CodeGenCXX/skip-vtable-pointer-initialization.cpp +++ b/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() +{ +} + +} -- cgit v1.2.3