diff options
author | Steve Naroff <snaroff@apple.com> | 2008-07-25 15:41:30 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-07-25 15:41:30 +0000 |
commit | 4ba0acbe835b12b3755d138f364cd67044d7322f (patch) | |
tree | 9a835b326556a671e37225aaa0298685d884b911 | |
parent | 5928cb633d5d5e73c598d5625bf717a57e6b10a3 (diff) |
Fix RewriteObjC::RewriteObjCThrowStmt() to respect whitespace between the @ and throw.
This fixes <rdar://problem/5988388> clang ObjC rewriter: mystery 'w' inserted in exception throw.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54017 91177308-0d34-0410-b5e6-96231b3b80d8
-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); |