Implemented memmove_collectable API for Next runtime
when struct variables with GC'able members are copied into.
Will provide a test case later.
llvm-svn: 74984
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 412a065..3898d16 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/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 @@
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);