summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCRuntime.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-05-12 01:00:15 +0000
committerJohn McCall <rjmccall@apple.com>2011-05-12 01:00:15 +0000
commit3f6e745292ce808773d7ac44670575680720b468 (patch)
tree101b012fd3f32fd0b0dd4a7cf8f5c777d4515a89 /clang/lib/CodeGen/CGObjCRuntime.cpp
parentcfdf33904b4ed64a1d6e75d456908f815df18885 (diff)
downloadbcm5719-llvm-3f6e745292ce808773d7ac44670575680720b468.tar.gz
bcm5719-llvm-3f6e745292ce808773d7ac44670575680720b468.zip
Make this code more resilient against catch variables which need cleanups.
llvm-svn: 131215
Diffstat (limited to 'clang/lib/CodeGen/CGObjCRuntime.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjCRuntime.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGObjCRuntime.cpp b/clang/lib/CodeGen/CGObjCRuntime.cpp
index 3d854d41acb..43fceceae2d 100644
--- a/clang/lib/CodeGen/CGObjCRuntime.cpp
+++ b/clang/lib/CodeGen/CGObjCRuntime.cpp
@@ -233,6 +233,8 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF,
cast<llvm::CallInst>(Exn)->setDoesNotThrow();
}
+ CodeGenFunction::RunCleanupsScope cleanups(CGF);
+
if (endCatchFn) {
// Add a cleanup to leave the catch.
bool EndCatchMightThrow = (Handler.Variable == 0);
@@ -255,9 +257,8 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF,
CGF.EmitStmt(Handler.Body);
CGF.ObjCEHValueStack.pop_back();
- // Leave the earlier cleanup.
- if (endCatchFn)
- CGF.PopCleanupBlock();
+ // Leave any cleanups associated with the catch.
+ cleanups.ForceCleanup();
CGF.EmitBranchThroughCleanup(Cont);
}
OpenPOWER on IntegriCloud