From 9e7dbd1cc6582ba72bb5a042996eee8dfcf8bff5 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 4 Aug 2011 23:58:03 +0000 Subject: objc rewriter: Fixes a rewriting of implicit casting of an integral argument to bool. // rdar://9899834 llvm-svn: 136946 --- clang/lib/Rewrite/RewriteObjC.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'clang/lib/Rewrite') 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 cast into an 'id' cast. -- cgit v1.2.3