modern objective-c translator: writing @throw statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152931 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp
index 1081b9d..855031e 100644
--- a/lib/Rewrite/RewriteModernObjC.cpp
+++ b/lib/Rewrite/RewriteModernObjC.cpp
@@ -1939,8 +1939,8 @@
/* void objc_exception_throw(id) __attribute__((noreturn)); */
if (S->getThrowExpr())
buf = "objc_exception_throw(";
- else // add an implicit argument
- buf = "objc_exception_throw(_caught";
+ else
+ buf = "throw";
// handle "@ throw" correctly.
const char *wBuf = strchr(startBuf, 'w');
@@ -1950,7 +1950,8 @@
const char *semiBuf = strchr(startBuf, ';');
assert((*semiBuf == ';') && "@throw: can't find ';'");
SourceLocation semiLoc = startLoc.getLocWithOffset(semiBuf-startBuf);
- ReplaceText(semiLoc, 1, ");");
+ if (S->getThrowExpr())
+ ReplaceText(semiLoc, 1, ");");
return 0;
}