From ef072fd2f3347cfd857d6eb787b245b950771430 Mon Sep 17 00:00:00 2001 From: John McCall Date: Sat, 22 May 2010 01:48:05 +0000 Subject: Push a return-value slot throughout ObjC message-send codegen. Will be critical for ObjC++ correctness; hard to test independently of various required Sema changes, though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104422 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprAgg.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'lib/CodeGen/CGExprAgg.cpp') diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 3bf2f8a520..aa32bb8d8d 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -37,6 +37,10 @@ class AggExprEmitter : public StmtVisitor { bool IgnoreResult; bool IsInitializer; bool RequiresGCollection; + + ReturnValueSlot getReturnValueSlot() const { + return ReturnValueSlot(DestPtr, VolatileDest); + } public: AggExprEmitter(CodeGenFunction &cgf, llvm::Value *destPtr, bool v, bool ignore, bool isinit, bool requiresGCollection) @@ -299,7 +303,7 @@ void AggExprEmitter::VisitCallExpr(const CallExpr *E) { // If the struct doesn't require GC, we can just pass the destination // directly to EmitCall. if (!RequiresGCollection) { - CGF.EmitCallExpr(E, ReturnValueSlot(DestPtr, VolatileDest)); + CGF.EmitCallExpr(E, getReturnValueSlot()); return; } @@ -308,19 +312,16 @@ void AggExprEmitter::VisitCallExpr(const CallExpr *E) { } void AggExprEmitter::VisitObjCMessageExpr(ObjCMessageExpr *E) { - RValue RV = CGF.EmitObjCMessageExpr(E); - EmitFinalDestCopy(E, RV); + CGF.EmitObjCMessageExpr(E, getReturnValueSlot()); } void AggExprEmitter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { - RValue RV = CGF.EmitObjCPropertyGet(E); - EmitFinalDestCopy(E, RV); + CGF.EmitObjCPropertyGet(E, getReturnValueSlot()); } void AggExprEmitter::VisitObjCImplicitSetterGetterRefExpr( ObjCImplicitSetterGetterRefExpr *E) { - RValue RV = CGF.EmitObjCPropertyGet(E); - EmitFinalDestCopy(E, RV); + CGF.EmitObjCPropertyGet(E, getReturnValueSlot()); } void AggExprEmitter::VisitBinComma(const BinaryOperator *E) { -- cgit v1.2.3