diff options
author | Steve Naroff <snaroff@apple.com> | 2008-11-03 11:20:24 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-11-03 11:20:24 +0000 |
commit | 8f6ce5796fb74daf0c4cd39fbda9f7ceb1c7a7b6 (patch) | |
tree | 3aab0bd8452565ff0909a08ed8424ab4077c54d2 | |
parent | e2f56196e916e4d2f9eeec5c8978490cdedb3f64 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58607 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/RewriteBlocks.cpp | 3 | ||||
-rw-r--r-- | Driver/RewriteObjC.cpp | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Driver/RewriteBlocks.cpp b/Driver/RewriteBlocks.cpp index cab4b81781..d8e347fafb 100644 --- a/Driver/RewriteBlocks.cpp +++ b/Driver/RewriteBlocks.cpp @@ -746,6 +746,9 @@ void RewriteBlocks::RewriteCastExpr(CastExpr *CE) { 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); diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 39f4f15ae9..ee9e2bc249 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -3570,6 +3570,9 @@ void RewriteObjC::RewriteCastExpr(CastExpr *CE) { // 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); |