Switch field destruction over to use the new destroyer-based API

and kill a lot of redundant code.

llvm-svn: 134988
This commit is contained in:
John McCall
2011-07-12 16:41:08 +00:00
parent 992a2856f5
commit 4bd0fb1f09
8 changed files with 194 additions and 402 deletions

View File

@@ -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;
}
}