[cfe-commits] r58607 - in /cfe/trunk/Driver: RewriteBlocks.cpp RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Mon Nov 3 03:20:24 PST 2008
Author: snaroff
Date: Mon Nov 3 05:20:24 2008
New Revision: 58607
URL: http://llvm.org/viewvc/llvm-project?rev=58607&view=rev
Log:
Fix <rdar://problem/6336774> clang block rewriter: Assertion failed: Offset+NumBytes <= size() && "Invalid region to erase!", file c:\cygwin\home\Administrator\llvm\to ols\clang\include\clang/Rewrite/RewriteRope.h, line 219.
Modified:
cfe/trunk/Driver/RewriteBlocks.cpp
cfe/trunk/Driver/RewriteObjC.cpp
Modified: cfe/trunk/Driver/RewriteBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteBlocks.cpp?rev=58607&r1=58606&r2=58607&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteBlocks.cpp (original)
+++ cfe/trunk/Driver/RewriteBlocks.cpp Mon Nov 3 05:20:24 2008
@@ -746,6 +746,9 @@
SourceLocation LocStart = CE->getLocStart();
SourceLocation LocEnd = CE->getLocEnd();
+ if (!Rewriter::isRewritable(LocStart) || !Rewriter::isRewritable(LocEnd))
+ return;
+
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
Modified: cfe/trunk/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteObjC.cpp?rev=58607&r1=58606&r2=58607&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteObjC.cpp (original)
+++ cfe/trunk/Driver/RewriteObjC.cpp Mon Nov 3 05:20:24 2008
@@ -3570,6 +3570,9 @@
// Need to avoid trying to rewrite synthesized casts.
if (LocStart.isInvalid())
return;
+ // Need to avoid trying to rewrite casts contained in macros.
+ if (!Rewriter::isRewritable(LocStart) || !Rewriter::isRewritable(LocEnd))
+ return;
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
More information about the cfe-commits
mailing list