aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-03-28 23:30:44 +0000
committerJohn McCall <rjmccall@apple.com>2012-03-28 23:30:44 +0000
commit57cd1b89cd91433ce1991a5bff36fe776a263796 (patch)
tree9d65d25e15649b8487c5a4e9fda2910c1a7dce74 /lib/CodeGen/CGStmt.cpp
parentb684a42154a555206a33ac47a52ad2a306cfa2b4 (diff)
When we can't prove that the target of an aggregate copy is
a complete object, the memcpy needs to use the data size of the structure instead of its sizeof() value. Fixes PR12204. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r--lib/CodeGen/CGStmt.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 670167b959..489386dfa2 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -722,7 +722,8 @@ void CodeGenFunction::EmitReturnOfRValue(RValue RV, QualType Ty) {
if (RV.isScalar()) {
Builder.CreateStore(RV.getScalarVal(), ReturnValue);
} else if (RV.isAggregate()) {
- EmitAggregateCopy(ReturnValue, RV.getAggregateAddr(), Ty);
+ EmitAggregateCopy(ReturnValue, RV.getAggregateAddr(), Ty,
+ /*volatile*/ false, 0, /*destIsCompleteObject*/ true);
} else {
StoreComplexToAddr(RV.getComplexVal(), ReturnValue, false);
}
@@ -769,7 +770,8 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
EmitAggExpr(RV, AggValueSlot::forAddr(ReturnValue, Alignment, Qualifiers(),
AggValueSlot::IsDestructed,
AggValueSlot::DoesNotNeedGCBarriers,
- AggValueSlot::IsNotAliased));
+ AggValueSlot::IsNotAliased,
+ AggValueSlot::IsCompleteObject));
}
EmitBranchThroughCleanup(ReturnBlock);