diff options
-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 |