summaryrefslogtreecommitdiffstats
path: root/clang/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-01-19 00:42:38 +0000
committerSteve Naroff <snaroff@apple.com>2008-01-19 00:42:38 +0000
commitc7d2df23f8f19c3b72f0a8c4e9b893642d0eb78b (patch)
tree22f12527a726310869ce5b036a230fc03941e166 /clang/Driver/RewriteTest.cpp
parent802583656e60afbe7ae95383dc6965ddcd8045c3 (diff)
downloadbcm5719-llvm-c7d2df23f8f19c3b72f0a8c4e9b893642d0eb78b.tar.gz
bcm5719-llvm-c7d2df23f8f19c3b72f0a8c4e9b893642d0eb78b.zip
Fix two bugs with an @throw that doesn't have a statement.
- ObjCAtThrowStmt::getSourceRange() needs to check if it has a statement (and not go "boom":-) - RewriteTest::RewriteObjCThrowStmt() needs to generate refer to the current exception. llvm-svn: 46184
Diffstat (limited to 'clang/Driver/RewriteTest.cpp')
-rw-r--r--clang/Driver/RewriteTest.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/Driver/RewriteTest.cpp b/clang/Driver/RewriteTest.cpp
index d9af1f97438..20c684c0d0e 100644
--- a/clang/Driver/RewriteTest.cpp
+++ b/clang/Driver/RewriteTest.cpp
@@ -1207,7 +1207,10 @@ Stmt *RewriteTest::RewriteObjCThrowStmt(ObjCAtThrowStmt *S) {
std::string buf;
/* void objc_exception_throw(id) __attribute__((noreturn)); */
- buf = "objc_exception_throw(";
+ if (S->getThrowExpr())
+ buf = "objc_exception_throw(";
+ else // add an implicit argument
+ buf = "objc_exception_throw(_caught";
Rewrite.ReplaceText(startLoc, 6, buf.c_str(), buf.size());
const char *semiBuf = strchr(startBuf, ';');
assert((*semiBuf == ';') && "@throw: can't find ';'");
OpenPOWER on IntegriCloud