summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-11-14 04:19:37 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-11-14 04:19:37 +0000
commitb572c92674574444122f4e27e6b89d9b1894bbb1 (patch)
treed7227584082f1fd61e717cf19fe754e2c18dc5e5
parent16797a1f557ce36bb04c8533642be9e0ff11a4d6 (diff)
downloadbcm5719-llvm-b572c92674574444122f4e27e6b89d9b1894bbb1.tar.gz
bcm5719-llvm-b572c92674574444122f4e27e6b89d9b1894bbb1.zip
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.) llvm-svn: 88755
-rw-r--r--clang/lib/CodeGen/CGCXX.cpp2
-rw-r--r--clang/test/CodeGenCXX/virt-dtor-gen.cpp10
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp
index bcb0b5c5c3b..a8261a5585a 100644
--- a/clang/lib/CodeGen/CGCXX.cpp
+++ b/clang/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/clang/test/CodeGenCXX/virt-dtor-gen.cpp b/clang/test/CodeGenCXX/virt-dtor-gen.cpp
new file mode 100644
index 00000000000..470c1a43c56
--- /dev/null
+++ b/clang/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
OpenPOWER on IntegriCloud