Fix <rdar://problem/6197841> try, finally with no catch stops the exception from being propagated
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56004 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp
index 45ce8af..b89e811 100644
--- a/Driver/RewriteObjC.cpp
+++ b/Driver/RewriteObjC.cpp
@@ -1380,6 +1380,11 @@
buf += " else { /* @catch continue */";
InsertText(startLoc, buf.c_str(), buf.size());
+ } else { /* no catch list */
+ buf = "}\nelse {\n";
+ buf += " _rethrow = objc_exception_extract(&_stack);\n";
+ buf += "}";
+ ReplaceText(lastCurlyLoc, 1, buf.c_str(), buf.size());
}
bool sawIdTypedCatch = false;
Stmt *lastCatchBody = 0;