[cfe-commits] r54017 - /cfe/trunk/Driver/RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Fri Jul 25 08:41:31 PDT 2008
Author: snaroff
Date: Fri Jul 25 10:41:30 2008
New Revision: 54017
URL: http://llvm.org/viewvc/llvm-project?rev=54017&view=rev
Log:
Fix RewriteObjC::RewriteObjCThrowStmt() to respect whitespace between the @ and throw.
This fixes <rdar://problem/5988388> clang ObjC rewriter: mystery 'w' inserted in exception throw.
Modified:
cfe/trunk/Driver/RewriteObjC.cpp
Modified: cfe/trunk/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteObjC.cpp?rev=54017&r1=54016&r2=54017&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteObjC.cpp (original)
+++ cfe/trunk/Driver/RewriteObjC.cpp Fri Jul 25 10:41:30 2008
@@ -1493,7 +1493,12 @@
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);
More information about the cfe-commits
mailing list