diff options
Diffstat (limited to 'lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | lib/CodeGen/CGBlocks.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index f529b583af..7c35091a2c 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -627,18 +627,21 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const BlockExpr *blockExpr) { // Push a destructor if necessary. The semantics for when this // actually gets run are really obscure. if (!ci->isByRef()) { - switch (type.isDestructedType()) { + switch (QualType::DestructionKind dtorKind = type.isDestructedType()) { case QualType::DK_none: break; - case QualType::DK_cxx_destructor: - PushDestructorCleanup(type, blockField); - break; + + // Block captures count as local values and have imprecise semantics. + // They also can't be arrays, so need to worry about that. case QualType::DK_objc_strong_lifetime: - PushARCReleaseCleanup(getARCCleanupKind(), type, blockField, false); + pushDestroy(getCleanupKind(dtorKind), blockField, type, + destroyARCStrongImprecise, + /*useEHCleanupForArray*/ false); break; + case QualType::DK_objc_weak_lifetime: - // __weak objects on the stack always get EH cleanups. - PushARCWeakReleaseCleanup(NormalAndEHCleanup, type, blockField); + case QualType::DK_cxx_destructor: + pushDestroy(dtorKind, blockField, type); break; } } |