[cfe-commits] r89984 - in /cfe/trunk: lib/CodeGen/CGCXX.cpp test/CodeGenCXX/virt-dtor-key.cpp

Eli Friedman eli.friedman at gmail.com
Thu Nov 26 17:42:13 PST 2009


Author: efriedma
Date: Thu Nov 26 19:42:12 2009
New Revision: 89984

URL: http://llvm.org/viewvc/llvm-project?rev=89984&view=rev
Log:
Fix for PR5594: use EmitGlobalDefinition instead of EmitCXXDestructor so that
we check whether the vtable needs to be generated.


Added:
    cfe/trunk/test/CodeGenCXX/virt-dtor-key.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=89984&r1=89983&r2=89984&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Thu Nov 26 19:42:12 2009
@@ -793,9 +793,9 @@
 
 void CodeGenModule::EmitCXXDestructors(const CXXDestructorDecl *D) {
   if (D->isVirtual())
-    EmitCXXDestructor(D, Dtor_Deleting);
-  EmitCXXDestructor(D, Dtor_Complete);
-  EmitCXXDestructor(D, Dtor_Base);
+    EmitGlobalDefinition(GlobalDecl(D, Dtor_Deleting));
+  EmitGlobalDefinition(GlobalDecl(D, Dtor_Complete));
+  EmitGlobalDefinition(GlobalDecl(D, Dtor_Base));
 }
 
 void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *D,

Added: cfe/trunk/test/CodeGenCXX/virt-dtor-key.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/virt-dtor-key.cpp?rev=89984&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenCXX/virt-dtor-key.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/virt-dtor-key.cpp Thu Nov 26 19:42:12 2009
@@ -0,0 +1,9 @@
+// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+// CHECK: @_ZTI3foo = linkonce_odr constant
+class foo {
+   foo();
+   virtual ~foo();
+};
+
+foo::~foo() {
+}





More information about the cfe-commits mailing list