diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-09-30 01:06:03 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-09-30 01:06:03 +0000 |
commit | 898d508d4c9e9d45914952473e39196b20830a9f (patch) | |
tree | e8c7ea7bf3d2719bf17ea24a33df5159417c0747 /lib/CodeGen/CGStmt.cpp | |
parent | 8b30c412198ed004d999f0047e48f87b95bd3205 (diff) |
Add infrastructure for proper @finally support.
- Provides a basic primitive to jump to an arbitrary basic block,
through the finally code.
- Only used for return statements and rethrow currently. Still need
to handle break, continue and goto.
- Code still needs to be shuffled around to live elsewhere.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56827 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index eb9dac1569..96550d6d53 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -437,6 +437,15 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) { EmitAggExpr(RV, ReturnValue, false); } + if (!ObjCEHStack.empty()) { + for (ObjCEHStackType::reverse_iterator i = ObjCEHStack.rbegin(), + e = ObjCEHStack.rend(); i != e; ++i) { + llvm::BasicBlock *ReturnPad = llvm::BasicBlock::Create("return.pad"); + EmitJumpThroughFinally(*i, ReturnPad); + EmitBlock(ReturnPad); + } + } + Builder.CreateBr(ReturnBlock); // Emit a block after the branch so that dead code after a return has some |