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 | 3f6e745292ce808773d7ac44670575680720b468 (patch) | |
tree | 101b012fd3f32fd0b0dd4a7cf8f5c777d4515a89 /clang/lib/CodeGen/CGObjCRuntime.cpp | |
parent | cfdf33904b4ed64a1d6e75d456908f815df18885 (diff) | |
download | bcm5719-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.cpp | 7 |
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); } |