diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-11-14 04:19:37 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-11-14 04:19:37 +0000 |
commit | ea9a20834cf9311fdf758cfbd73b8daa8e655f15 (patch) | |
tree | 514dc451dfd1c3053eff0ce5376acf6774f02ef1 | |
parent | 49e2b8e2e5d096851b5135ea5aed222e8aa95bde (diff) |
PR5483: Generate missing form of destructor when it is virtual. (Someone
more familiar with this stuff should double-check that there isn't some more
general rule; this is purely from inspecting g++ output.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88755 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/virt-dtor-gen.cpp | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index bcb0b5c5c3..a8261a5585 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -752,6 +752,8 @@ const char *CodeGenModule::getMangledCXXCtorName(const CXXConstructorDecl *D, } void CodeGenModule::EmitCXXDestructors(const CXXDestructorDecl *D) { + if (D->isVirtual()) + EmitCXXDestructor(D, Dtor_Deleting); EmitCXXDestructor(D, Dtor_Complete); EmitCXXDestructor(D, Dtor_Base); } diff --git a/test/CodeGenCXX/virt-dtor-gen.cpp b/test/CodeGenCXX/virt-dtor-gen.cpp new file mode 100644 index 0000000000..470c1a43c5 --- /dev/null +++ b/test/CodeGenCXX/virt-dtor-gen.cpp @@ -0,0 +1,10 @@ +// clang-cc -o - -emit-llvm %s | FileCheck %s +// PR5483 + +// Make sure we generate all three forms of the destructor when it is virtual. +class Foo { + virtual ~Foo(); +}; +Foo::~Foo() {} + +// CHECK: define void @_ZN3FooD0Ev |