diff options
author | Richard Smith <richard@metafoo.co.uk> | 2020-01-10 15:16:15 -0800 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2020-01-10 15:18:36 -0800 |
commit | 7a38468e34eeeb59e80b176b97213d205d8d9b41 (patch) | |
tree | fb8054b8dbe96661bca0d22c0b9df58e540e7295 /clang/lib/CodeGen | |
parent | d3ba1e026dbc44e9097ce6ea1c92d065f1fe33e8 (diff) | |
download | bcm5719-llvm-7a38468e34eeeb59e80b176b97213d205d8d9b41.tar.gz bcm5719-llvm-7a38468e34eeeb59e80b176b97213d205d8d9b41.zip |
Only destroy static locals if they have non-trivial destructors.
This fixes a regression introduced in
2b4fa5348ee157b6b1a1af44d0137ca8c7a71573 that caused us to emit
shutdown-time destruction for variables with ARC ownership, using
C++-specific functions that don't exist in C implementations.
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 61fb8fa384c..86e02d2d7e4 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -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 && + HaveInsertPoint()) { // We have a constant initializer, but a nontrivial destructor. We still // need to perform a guarded "initialization" in order to register the // destructor. |