summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-08-04 23:58:03 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-08-04 23:58:03 +0000
commit9e7dbd1cc6582ba72bb5a042996eee8dfcf8bff5 (patch)
treee602e2c9cb90c3cf420c4401533966e71da185b9 /clang/lib/Rewrite
parentcd1c0236fe46c507c533bc81e1e66336b2dbaa64 (diff)
downloadbcm5719-llvm-9e7dbd1cc6582ba72bb5a042996eee8dfcf8bff5.tar.gz
bcm5719-llvm-9e7dbd1cc6582ba72bb5a042996eee8dfcf8bff5.zip
objc rewriter: Fixes a rewriting of implicit casting of an integral
argument to bool. // rdar://9899834 llvm-svn: 136946
Diffstat (limited to 'clang/lib/Rewrite')
-rw-r--r--clang/lib/Rewrite/RewriteObjC.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp
index 63e2084686f..3ba7e90dac9 100644
--- a/clang/lib/Rewrite/RewriteObjC.cpp
+++ b/clang/lib/Rewrite/RewriteObjC.cpp
@@ -3008,7 +3008,11 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
type = Context->getObjCIdType();
// Make sure we convert "type (^)(...)" to "type (*)(...)".
(void)convertBlockPointerToFunctionPointer(type);
- userExpr = NoTypeInfoCStyleCastExpr(Context, type, CK_BitCast,
+ const Expr *SubExpr = ICE->IgnoreParenImpCasts();
+ bool integral = SubExpr->getType()->isIntegralType(*Context);
+ userExpr = NoTypeInfoCStyleCastExpr(Context, type,
+ (integral && type->isBooleanType())
+ ? CK_IntegralToBoolean : CK_BitCast,
userExpr);
}
// Make id<P...> cast into an 'id' cast.
OpenPOWER on IntegriCloud