diff options
author | John McCall <rjmccall@apple.com> | 2011-05-12 01:00:15 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-05-12 01:00:15 +0000 |
commit | fe3e3bd63d73c1a370b0b0447b8744d495fa6626 (patch) | |
tree | 6b9250385bc6e72fe593ae8023f84ba9b64d1ced | |
parent | 640c63cf4db3847b9d59878e9e5372332e2cd141 (diff) |
Make this code more resilient against catch variables which need cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131215 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGObjCRuntime.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/CGObjCRuntime.cpp b/lib/CodeGen/CGObjCRuntime.cpp index 3d854d41ac..43fceceae2 100644 --- a/lib/CodeGen/CGObjCRuntime.cpp +++ b/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); } |