aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-12 16:41:08 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-12 16:41:08 +0000
commit9928c4805aa8d5fabd488d0d0c5aeb64fd50f0e3 (patch)
treeb3860a47a6a5f606e5057653deddc0dd84d70635 /lib/CodeGen/CGBlocks.cpp
parentf1588660c109610e6a79c786b83b7c9bbd6ed31e (diff)
Switch field destruction over to use the new destroyer-based API
and kill a lot of redundant code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134988 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBlocks.cpp')
-rw-r--r--lib/CodeGen/CGBlocks.cpp17
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;
}
}