[cfe-commits] r88755 - in /cfe/trunk: lib/CodeGen/CGCXX.cpp test/CodeGenCXX/virt-dtor-gen.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Nov 13 20:19:42 PST 2009
Author: efriedma
Date: Fri Nov 13 22:19:37 2009
New Revision: 88755
URL: http://llvm.org/viewvc/llvm-project?rev=88755&view=rev
Log:
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.)
Added:
cfe/trunk/test/CodeGenCXX/virt-dtor-gen.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=88755&r1=88754&r2=88755&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Fri Nov 13 22:19:37 2009
@@ -752,6 +752,8 @@
}
void CodeGenModule::EmitCXXDestructors(const CXXDestructorDecl *D) {
+ if (D->isVirtual())
+ EmitCXXDestructor(D, Dtor_Deleting);
EmitCXXDestructor(D, Dtor_Complete);
EmitCXXDestructor(D, Dtor_Base);
}
Added: cfe/trunk/test/CodeGenCXX/virt-dtor-gen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/virt-dtor-gen.cpp?rev=88755&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/virt-dtor-gen.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/virt-dtor-gen.cpp Fri Nov 13 22:19:37 2009
@@ -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
More information about the cfe-commits
mailing list