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
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index eb9dac1..96550d6 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -437,6 +437,15 @@
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