summaryrefslogtreecommitdiffstats
path: root/clang/Driver/RewriteObjC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/Driver/RewriteObjC.cpp')
-rw-r--r--clang/Driver/RewriteObjC.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/Driver/RewriteObjC.cpp b/clang/Driver/RewriteObjC.cpp
index 39f4f15ae9b..ee9e2bc2492 100644
--- a/clang/Driver/RewriteObjC.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud