diff options
| author | John McCall <rjmccall@apple.com> | 2012-04-13 02:53:27 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2012-04-13 02:53:27 +0000 |
| commit | 32233a7c1ae04432a9d12c0d9f029cce552ec24a (patch) | |
| tree | 8bac1b52daa04232896171bcf2d192cfac778f50 /clang | |
| parent | f958f348c818a53c99efc3ad260340cddc98e57f (diff) | |
| download | bcm5719-llvm-32233a7c1ae04432a9d12c0d9f029cce552ec24a.tar.gz bcm5719-llvm-32233a7c1ae04432a9d12c0d9f029cce552ec24a.zip | |
Fix a trivial oversight with apple-kext static local destructors
and add a test case.
llvm-svn: 154653
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/CodeGen/CGDeclCXX.cpp | 1 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/apple-kext.cpp | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 99d50312b52..10f0b83e405 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -244,6 +244,7 @@ void CodeGenFunction::EmitCXXGlobalDtorRegistration(llvm::Constant *dtor, if (CGM.getContext().getLangOpts().AppleKext) { // Generate a global destructor entry. CGM.AddCXXDtorEntry(dtor, addr); + return; } // Otherwise, we just use atexit. diff --git a/clang/test/CodeGenCXX/apple-kext.cpp b/clang/test/CodeGenCXX/apple-kext.cpp new file mode 100644 index 00000000000..03506a8aacf --- /dev/null +++ b/clang/test/CodeGenCXX/apple-kext.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fno-use-cxa-atexit -fapple-kext -emit-llvm -o - %s | FileCheck %s + +// CHECK: @_ZN5test01aE = global [[A:%.*]] zeroinitializer +// CHECK: @llvm.global_ctors = appending global {{.*}} { i32 65535, void ()* [[CTOR0:@.*]] } +// CHECK: @llvm.global_dtors = appending global {{.*}} { i32 65535, void ()* [[DTOR0:@.*]] } + +// rdar://11241230 +namespace test0 { + struct A { A(); ~A(); }; + A a; +} +// CHECK: define internal void [[CTOR0_:@.*]]() +// CHECK: call void @_ZN5test01AC1Ev([[A]]* @_ZN5test01aE) +// CHECK-NEXT: ret void + +// CHECK: define internal void [[CTOR0]]() +// CHECK: call void [[CTOR0_]]() +// CHECK-NEXT: ret void + +// CHECK: define internal void [[DTOR0]]() +// CHECK: call void @_ZN5test01AD1Ev([[A]]* @_ZN5test01aE) +// CHECK-NEXT: ret void |

