aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-07-08 01:18:33 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-07-08 01:18:33 +0000
commit082b02e8403d3ee9d2ded969fbe0e5d472f04cd8 (patch)
treeddcfcdd6538dff86a39f9298f38571711705bdb2 /lib/CodeGen/CGExprAgg.cpp
parent9c10fcfc3b9d2076efe701b60644a9987a93c503 (diff)
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
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--lib/CodeGen/CGExprAgg.cpp12
1 files changed, 12 insertions, 0 deletions
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);