@@ -610,9 +610,9 @@ void RewriteObjC::Initialize(ASTContext &context) {
610
610
Preamble += " (struct objc_object *, struct objc_selector *, ...);\n " ;
611
611
Preamble += " __OBJC_RW_DLLIMPORT struct objc_object *objc_msgSendSuper" ;
612
612
Preamble += " (struct objc_super *, struct objc_selector *, ...);\n " ;
613
- Preamble += " __OBJC_RW_DLLIMPORT struct objc_object * objc_msgSend_stret" ;
613
+ Preamble += " __OBJC_RW_DLLIMPORT void objc_msgSend_stret" ;
614
614
Preamble += " (struct objc_object *, struct objc_selector *, ...);\n " ;
615
- Preamble += " __OBJC_RW_DLLIMPORT struct objc_object * objc_msgSendSuper_stret" ;
615
+ Preamble += " __OBJC_RW_DLLIMPORT void objc_msgSendSuper_stret" ;
616
616
Preamble += " (struct objc_super *, struct objc_selector *, ...);\n " ;
617
617
Preamble += " __OBJC_RW_DLLIMPORT double objc_msgSend_fpret" ;
618
618
Preamble += " (struct objc_object *, struct objc_selector *, ...);\n " ;
@@ -2566,7 +2566,7 @@ void RewriteObjC::SynthMsgSendSuperFunctionDecl() {
2566
2566
SC_None, false );
2567
2567
}
2568
2568
2569
- // SynthMsgSendStretFunctionDecl - id objc_msgSend_stret(id self, SEL op, ...);
2569
+ // SynthMsgSendStretFunctionDecl - void objc_msgSend_stret(id self, SEL op, ...);
2570
2570
void RewriteObjC::SynthMsgSendStretFunctionDecl () {
2571
2571
IdentifierInfo *msgSendIdent = &Context->Idents .get (" objc_msgSend_stret" );
2572
2572
SmallVector<QualType, 16 > ArgTys;
@@ -2576,7 +2576,7 @@ void RewriteObjC::SynthMsgSendStretFunctionDecl() {
2576
2576
argT = Context->getObjCSelType ();
2577
2577
assert (!argT.isNull () && " Can't find 'SEL' type" );
2578
2578
ArgTys.push_back (argT);
2579
- QualType msgSendType = getSimpleFunctionType (Context->getObjCIdType () ,
2579
+ QualType msgSendType = getSimpleFunctionType (Context->VoidTy ,
2580
2580
&ArgTys[0 ], ArgTys.size (),
2581
2581
true /* isVariadic*/ );
2582
2582
MsgSendStretFunctionDecl = FunctionDecl::Create (*Context, TUDecl,
@@ -2588,7 +2588,7 @@ void RewriteObjC::SynthMsgSendStretFunctionDecl() {
2588
2588
}
2589
2589
2590
2590
// SynthMsgSendSuperStretFunctionDecl -
2591
- // id objc_msgSendSuper_stret(struct objc_super *, SEL op, ...);
2591
+ // void objc_msgSendSuper_stret(struct objc_super *, SEL op, ...);
2592
2592
void RewriteObjC::SynthMsgSendSuperStretFunctionDecl () {
2593
2593
IdentifierInfo *msgSendIdent =
2594
2594
&Context->Idents .get (" objc_msgSendSuper_stret" );
@@ -2602,7 +2602,7 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() {
2602
2602
argT = Context->getObjCSelType ();
2603
2603
assert (!argT.isNull () && " Can't find 'SEL' type" );
2604
2604
ArgTys.push_back (argT);
2605
- QualType msgSendType = getSimpleFunctionType (Context->getObjCIdType () ,
2605
+ QualType msgSendType = getSimpleFunctionType (Context->VoidTy ,
2606
2606
&ArgTys[0 ], ArgTys.size (),
2607
2607
true /* isVariadic*/ );
2608
2608
MsgSendSuperStretFunctionDecl = FunctionDecl::Create (*Context, TUDecl,
@@ -3032,8 +3032,13 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
3032
3032
Expr *recExpr = Exp->getInstanceReceiver ();
3033
3033
while (CStyleCastExpr *CE = dyn_cast<CStyleCastExpr>(recExpr))
3034
3034
recExpr = CE->getSubExpr ();
3035
+ CastKind CK = recExpr->getType ()->isObjCObjectPointerType ()
3036
+ ? CK_BitCast : recExpr->getType ()->isBlockPointerType ()
3037
+ ? CK_BlockPointerToObjCPointerCast
3038
+ : CK_CPointerToObjCPointerCast;
3039
+
3035
3040
recExpr = NoTypeInfoCStyleCastExpr (Context, Context->getObjCIdType (),
3036
- CK_BitCast , recExpr);
3041
+ CK , recExpr);
3037
3042
MsgExprs.push_back (recExpr);
3038
3043
break ;
3039
3044
}
0 commit comments