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
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index f529b58..7c35091 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -627,18 +627,21 @@
// 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;
}
}