summaryrefslogtreecommitdiffstats
path: root/clang/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
commit1a0877f99dc8130f3b85ab096bc03059e4c3cd0a (patch)
treeed675c50db4cc6b68ac8636470be7746e92b6814 /clang/lib/CodeGen/CGStmt.cpp
parent7e58b3862a61b1297e1e6a12e14205d1d2df346b (diff)
downloadbcm5719-llvm-1a0877f99dc8130f3b85ab096bc03059e4c3cd0a.tar.gz
bcm5719-llvm-1a0877f99dc8130f3b85ab096bc03059e4c3cd0a.zip
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. llvm-svn: 153613
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 670167b9590..489386dfa2e 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud