-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This fixes a regression introduced in 2b4fa53 that caused us to emit shutdown-time destruction for variables with ARC ownership, using C++-specific functions that don't exist in C implementations.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -366,7 +366,8 @@ CodeGenFunction::AddInitializerToStaticVarDecl(const VarDecl &D, | |
|
||
emitter.finalize(GV); | ||
|
||
if (D.needsDestruction(getContext()) && HaveInsertPoint()) { | ||
if (D.needsDestruction(getContext()) == QualType::DK_cxx_destructor && | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zygoloid
Author
Collaborator
|
||
HaveInsertPoint()) { | ||
// We have a constant initializer, but a nontrivial destructor. We still | ||
// need to perform a guarded "initialization" in order to register the | ||
// destructor. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// RUN: %clang_cc1 -triple x86_64-apple-macos10.15 -emit-llvm -fobjc-arc -o - %s | FileCheck %s | ||
|
||
@interface I | ||
@end | ||
|
||
I *i() { | ||
static I *i = ((void *)0); | ||
return i; | ||
} | ||
|
||
// CHECK-NOT: __cxa_guard_acquire | ||
// CHECK-NOT: __cxa_guard_release |
I feel like handling this in
VarDecl::needsDestruction
is probably the better fix.