diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-03-07 22:38:24 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-03-07 22:38:24 +0000 |
commit | 6cda3e604f2a2fa289cc9145719ba84461315e21 (patch) | |
tree | e167f3a481592821f8084e509d284360787eb3fa /lib/Sema/SemaDecl.cpp | |
parent | 9eda3abe7e183b05834947391c0cdc291f4ee0d8 (diff) |
When possible, move __block variables to the heap rather than copying them.
Fixes <rdar://problem/13330126>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176663 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 82d216ee01..4fa790515d 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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>(); |