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/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 7e0422e..5b74938 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -911,8 +911,10 @@
assert(!ToType->isReferenceType());
// FIXME: Keep track of whether the copy constructor is elidable or not.
- From = BuildCXXConstructExpr(Context,
- ToType, SCS.CopyConstructor, false, &From, 1);
+ bool Elidable = (isa<CallExpr>(From) ||
+ isa<CXXTemporaryObjectExpr>(From));
+ From = BuildCXXConstructExpr(Context, ToType,
+ SCS.CopyConstructor, Elidable, &From, 1);
return false;
}