diff options
Diffstat (limited to 'Driver/RewriteObjC.cpp')
-rw-r--r-- | Driver/RewriteObjC.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 0ee0599b89..641da1877d 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -1493,7 +1493,12 @@ Stmt *RewriteObjC::RewriteObjCThrowStmt(ObjCAtThrowStmt *S) { buf = "objc_exception_throw("; else // add an implicit argument buf = "objc_exception_throw(_caught"; - ReplaceText(startLoc, 6, buf.c_str(), buf.size()); + + // handle "@ throw" correctly. + const char *wBuf = strchr(startBuf, 'w'); + assert((*wBuf == 'w') && "@throw: can't find 'w'"); + ReplaceText(startLoc, wBuf-startBuf+1, buf.c_str(), buf.size()); + const char *semiBuf = strchr(startBuf, ';'); assert((*semiBuf == ';') && "@throw: can't find ';'"); SourceLocation semiLoc = startLoc.getFileLocWithOffset(semiBuf-startBuf); |