summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-03-07 22:38:24 +0000
committerDouglas Gregor <dgregor@apple.com>2013-03-07 22:38:24 +0000
commitca00645e4cc0fe255e7cf31545254cf6bb97e90e (patch)
treebd535280c72fd8b09d6539aff04a6228d5969a68 /clang/lib/Sema/SemaDecl.cpp
parent3d27e6603a1605ccf6bae568ca86ddc5aa266f96 (diff)
downloadbcm5719-llvm-ca00645e4cc0fe255e7cf31545254cf6bb97e90e.tar.gz
bcm5719-llvm-ca00645e4cc0fe255e7cf31545254cf6bb97e90e.zip
When possible, move __block variables to the heap rather than copying them.
Fixes <rdar://problem/13330126>. llvm-svn: 176663
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 82d216ee01c..4fa790515da 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -7811,10 +7811,10 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
if (type->isStructureOrClassType()) {
SourceLocation poi = var->getLocation();
Expr *varRef =new (Context) DeclRefExpr(var, false, type, VK_LValue, poi);
- ExprResult result =
- PerformCopyInitialization(
- InitializedEntity::InitializeBlock(poi, type, false),
- poi, Owned(varRef));
+ ExprResult result
+ = PerformMoveOrCopyInitialization(
+ InitializedEntity::InitializeBlock(poi, type, false),
+ var, var->getType(), varRef, /*AllowNRVO=*/true);
if (!result.isInvalid()) {
result = MaybeCreateExprWithCleanups(result);
Expr *init = result.takeAs<Expr>();
OpenPOWER on IntegriCloud