[cfe-commits] r131434 - in /cfe/trunk: lib/CodeGen/CGCXX.cpp test/CodeGenCXX/apple-kext-symbols.cpp
John McCall
rjmccall at apple.com
Mon May 16 16:34:46 PDT 2011
Author: rjmccall
Date: Mon May 16 18:34:46 2011
New Revision: 131434
URL: http://llvm.org/viewvc/llvm-project?rev=131434&view=rev
Log:
Emit complete-object constructors for abstract classes in kext mode for
reasons that honestly really, really need to be looked into.
Added:
cfe/trunk/test/CodeGenCXX/apple-kext-symbols.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=131434&r1=131433&r2=131434&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Mon May 16 18:34:46 2011
@@ -176,8 +176,9 @@
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));
}
Added: cfe/trunk/test/CodeGenCXX/apple-kext-symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/apple-kext-symbols.cpp?rev=131434&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/apple-kext-symbols.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/apple-kext-symbols.cpp Mon May 16 18:34:46 2011
@@ -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() {}
+}
+
More information about the cfe-commits
mailing list