diff options
author | Anders Carlsson <andersca@mac.com> | 2009-02-08 22:25:30 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-02-08 22:25:30 +0000 |
commit | 48de1012a2d8525362b417efce6fbfdf1c2b36e1 (patch) | |
tree | b651aa12224d81bd498f3137a301f7f70411dbee | |
parent | 46831a93e1805ddaebd68f37cdb5496a86b44cf0 (diff) |
Add a simplified EmitJumpThroughFinally and use it in CGObjC in preparation of making it use the cleanup stack.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64098 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 21 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 5 |
2 files changed, 15 insertions, 11 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index ba2f5262fd..aad569aace 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -1904,7 +1904,7 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, CGF.EmitBlock(TryBlock); CGF.EmitStmt(isTry ? cast<ObjCAtTryStmt>(S).getTryBody() : cast<ObjCAtSynchronizedStmt>(S).getSynchBody()); - CGF.EmitJumpThroughFinally(&EHEntry, FinallyEnd); + CGF.EmitJumpThroughFinally(FinallyEnd); // Emit the "exception in @try" block. CGF.EmitBlock(TryHandler); @@ -1919,7 +1919,7 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, { CGF.Builder.CreateStore(Caught, RethrowPtr); CGF.Builder.CreateStore(llvm::ConstantInt::getFalse(), CallTryExitPtr); - CGF.EmitJumpThroughFinally(&EHEntry, FinallyRethrow, false); + CGF.EmitJumpThroughFinally(FinallyRethrow); } else if (const ObjCAtCatchStmt* CatchStmt = cast<ObjCAtTryStmt>(S).getCatchStmts()) @@ -1973,7 +1973,7 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, } CGF.EmitStmt(CatchStmt->getCatchBody()); - CGF.EmitJumpThroughFinally(&EHEntry, FinallyEnd); + CGF.EmitJumpThroughFinally(FinallyEnd); break; } @@ -2004,7 +2004,7 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, CGF.Builder.CreateStore(Tmp, CGF.GetAddrOfLocalVar(VD)); CGF.EmitStmt(CatchStmt->getCatchBody()); - CGF.EmitJumpThroughFinally(&EHEntry, FinallyEnd); + CGF.EmitJumpThroughFinally(FinallyEnd); CGF.EmitBlock(NextCatchBlock); } @@ -2013,7 +2013,7 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, // None of the handlers caught the exception, so store it to be // rethrown at the end of the @finally block. CGF.Builder.CreateStore(Caught, RethrowPtr); - CGF.EmitJumpThroughFinally(&EHEntry, FinallyRethrow); + CGF.EmitJumpThroughFinally(FinallyRethrow); } // Emit the exception handler for the @catch blocks. @@ -2022,11 +2022,11 @@ void CGObjCMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, ExceptionData), RethrowPtr); CGF.Builder.CreateStore(llvm::ConstantInt::getFalse(), CallTryExitPtr); - CGF.EmitJumpThroughFinally(&EHEntry, FinallyRethrow, false); + CGF.EmitJumpThroughFinally(FinallyRethrow); } else { CGF.Builder.CreateStore(Caught, RethrowPtr); CGF.Builder.CreateStore(llvm::ConstantInt::getFalse(), CallTryExitPtr); - CGF.EmitJumpThroughFinally(&EHEntry, FinallyRethrow, false); + CGF.EmitJumpThroughFinally(FinallyRethrow); } // Pop the exception-handling stack entry. It is important to do @@ -2090,9 +2090,12 @@ void CGObjCMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF, CGF.Builder.ClearInsertionPoint(); } +void CodeGenFunction::EmitJumpThroughFinally(llvm::BasicBlock *Dest) { + EmitJumpThroughFinally(ObjCEHStack.back(), Dest); +} + void CodeGenFunction::EmitJumpThroughFinally(ObjCEHEntry *E, - llvm::BasicBlock *Dst, - bool ExecuteTryExit) { + llvm::BasicBlock *Dst) { if (!HaveInsertPoint()) return; diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 320e26b82d..248bb18262 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -125,8 +125,9 @@ public: /// /// \param ExecuteTryExit - When true, the try_exit runtime function /// should be called prior to executing the finally code. - void EmitJumpThroughFinally(ObjCEHEntry *Entry, llvm::BasicBlock *Dest, - bool ExecuteTryExit=true); + void EmitJumpThroughFinally(ObjCEHEntry *Entry, llvm::BasicBlock *Dest); + + void EmitJumpThroughFinally(llvm::BasicBlock *Dest); /// PushCleanupBlock - Push a new cleanup entry on the stack and set the /// passed in block as the cleanup block. |