From: John McCall Date: Mon, 16 May 2011 23:34:46 +0000 (+0000) Subject: Emit complete-object constructors for abstract classes in kext mode for X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3217395e88e661e2a1c2b7eecb59629f67945b41;p=clang Emit complete-object constructors for abstract classes in kext mode for reasons that honestly really, really need to be looked into. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131434 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index f6fc202eaa..09e0aa63b6 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -176,8 +176,9 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl, void CodeGenModule::EmitCXXConstructors(const CXXConstructorDecl *D) { // The constructor used for constructing this as a complete class; // constucts the virtual bases, then calls the base constructor. - if (!D->getParent()->isAbstract()) { + if (!D->getParent()->isAbstract() || getLangOptions().AppleKext) { // We don't need to emit the complete ctor if the class is abstract. + // But kexts somehow manage to violate this assumption. EmitGlobal(GlobalDecl(D, Ctor_Complete)); } diff --git a/test/CodeGenCXX/apple-kext-symbols.cpp b/test/CodeGenCXX/apple-kext-symbols.cpp new file mode 100644 index 0000000000..f9aeafc3ad --- /dev/null +++ b/test/CodeGenCXX/apple-kext-symbols.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fapple-kext -emit-llvm -o - %s | FileCheck %s + +// rdar://problem/9429976 +namespace test0 { + struct A { + A(); + virtual ~A(); + virtual void foo() = 0; + }; + + // CHECK: define void @_ZN5test01AC1Ev( + // CHECK: define void @_ZN5test01AC2Ev( + A::A() {} + + // CHECK: define void @_ZN5test01AD0Ev( + // CHECK: define void @_ZN5test01AD1Ev( + // CHECK: define void @_ZN5test01AD2Ev( + A::~A() {} +} +