Set and use Elidable in elimination of copy ctors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78331 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 445cd69..2911382 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -176,9 +176,10 @@
DirectInit? IK_Direct : IK_Copy);
if (!Constructor)
return true;
-
+ bool Elidable = (isa<CallExpr>(Init) ||
+ isa<CXXTemporaryObjectExpr>(Init));
Init = BuildCXXConstructExpr(Context,
- DeclType, Constructor, false, &Init, 1);
+ DeclType, Constructor, Elidable, &Init, 1);
Init = MaybeCreateCXXExprWithTemporaries(Init, /*DestroyTemps=*/true);
return false;
}