aboutsummaryrefslogtreecommitdiff
path: root/lib/Rewrite/RewriteObjC.cpp
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
commit1a38b46ae2f818592577546c8c800ada8de7962b (patch)
treeb0fa133540fb7a7e7587b17469fe0b03b39f577b /lib/Rewrite/RewriteObjC.cpp
parentdd7fddb5b6883326e52b278a9b7e9cefea29aae0 (diff)
objc rewriter: Fixes a rewriting of implicit casting of an integral
argument to bool. // rdar://9899834 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/RewriteObjC.cpp')
-rw-r--r--lib/Rewrite/RewriteObjC.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp
index 63e2084686..3ba7e90dac 100644
--- a/lib/Rewrite/RewriteObjC.cpp
+++ b/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.