From 082b02e8403d3ee9d2ded969fbe0e5d472f04cd8 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 8 Jul 2009 01:18:33 +0000 Subject: Implemented memmove_collectable API for Next runtime when struct variables with GC'able members are copied into. Will provide a test case later. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74984 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprAgg.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/CodeGen/CGExprAgg.cpp') diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 412a06594f..3898d16447 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -13,6 +13,7 @@ #include "CodeGenFunction.h" #include "CodeGenModule.h" +#include "CGObjCRuntime.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/StmtVisitor.h" @@ -249,6 +250,17 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) { CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), RValue::getAggregate(AggLoc, VolatileDest)); } else { + if (CGF.getContext().getLangOptions().NeXTRuntime) { + QualType LHSTy = E->getLHS()->getType(); + if (const RecordType *FDTTy = LHSTy.getTypePtr()->getAsRecordType()) + if (FDTTy->getDecl()->hasObjectMember()) { + LValue RHS = CGF.EmitLValue(E->getRHS()); + CGF.CGM.getObjCRuntime().EmitGCMemmoveCollectable(CGF, LHS.getAddress(), + RHS.getAddress(), + CGF.getContext().getTypeSize(LHSTy) / 8); + return; + } + } // Codegen the RHS so that it stores directly into the LHS. CGF.EmitAggExpr(E->getRHS(), LHS.getAddress(), LHS.isVolatileQualified()); EmitFinalDestCopy(E, LHS, true); -- cgit v1.2.3-70-g09d2