From 09ac6f21c3611accb56ae9604c8b6743f9aab987 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Tue, 26 May 2009 15:22:25 +0000 Subject: [PATCH] An Obj-C message send expression can never have a reference type. llvm-svn: 72417 --- clang/lib/Sema/SemaExprObjC.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 1ad9096e50c4..3bee461cf6fb 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -444,6 +444,8 @@ Sema::ExprResult Sema::ActOnClassMessage( lbrac, rbrac, returnType)) return true; + returnType = returnType.getNonReferenceType(); + // If we have the ObjCInterfaceDecl* for the class that is receiving the // message, use that to construct the ObjCMessageExpr. Otherwise pass on the // IdentifierInfo* for the class. @@ -500,6 +502,8 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false, lbrac, rbrac, returnType)) return true; + + returnType = returnType.getNonReferenceType(); return new (Context) ObjCMessageExpr(RExpr, Sel, returnType, Method, lbrac, rbrac, ArgExprs, NumArgs); } @@ -515,6 +519,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false, lbrac, rbrac, returnType)) return true; + returnType = returnType.getNonReferenceType(); return new (Context) ObjCMessageExpr(RExpr, Sel, returnType, Method, lbrac, rbrac, ArgExprs, NumArgs); } @@ -556,6 +561,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false, lbrac, rbrac, returnType)) return true; + returnType = returnType.getNonReferenceType(); return new (Context) ObjCMessageExpr(RExpr, Sel, returnType, Method, lbrac, rbrac, ArgExprs, NumArgs); } @@ -632,6 +638,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false, lbrac, rbrac, returnType)) return true; + returnType = returnType.getNonReferenceType(); return new (Context) ObjCMessageExpr(RExpr, Sel, returnType, Method, lbrac, rbrac, ArgExprs, NumArgs); }