diff options
author | John McCall <rjmccall@apple.com> | 2013-02-01 05:11:40 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-02-01 05:11:40 +0000 |
commit | 074cae0861a87bf96d8ea56d02e34839d9ccbd0a (patch) | |
tree | a75e3a668f4ebae4ffeaa83a0cc11606862df0f0 /lib/CodeGen/CGDecl.cpp | |
parent | 10318845f40d50b9d0ce010b0ea8d93a7b5ab029 (diff) |
Destroy arrays and ARC fields when throwing out of ctors.
Previously we were only handling non-array fields of class type.
Testcases derived from a patch by WenHan Gu.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174146 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index ac45339515..a43a38360b 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -1242,7 +1242,18 @@ CodeGenFunction::getDestroyer(QualType::DestructionKind kind) { llvm_unreachable("Unknown DestructionKind"); } -/// pushDestroy - Push the standard destructor for the given type. +/// pushEHDestroy - Push the standard destructor for the given type as +/// an EH-only cleanup. +void CodeGenFunction::pushEHDestroy(QualType::DestructionKind dtorKind, + llvm::Value *addr, QualType type) { + assert(dtorKind && "cannot push destructor for trivial type"); + assert(needsEHCleanup(dtorKind)); + + pushDestroy(EHCleanup, addr, type, getDestroyer(dtorKind), true); +} + +/// pushDestroy - Push the standard destructor for the given type as +/// at least a normal cleanup. void CodeGenFunction::pushDestroy(QualType::DestructionKind dtorKind, llvm::Value *addr, QualType type) { assert(dtorKind && "cannot push destructor for trivial type"); |