[cfe-commits] r124455 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CodeGenCXX/rvalue-references.cpp
Douglas Gregor
dgregor at apple.com
Thu Jan 27 15:24:55 PST 2011
Author: dgregor
Date: Thu Jan 27 17:24:55 2011
New Revision: 124455
URL: http://llvm.org/viewvc/llvm-project?rev=124455&view=rev
Log:
Allow elision of invocations of move constructors from temporary objects.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CodeGenCXX/rvalue-references.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=124455&r1=124454&r2=124455&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Jan 27 17:24:55 2011
@@ -5551,7 +5551,7 @@
// can be omitted by constructing the temporary object
// directly into the target of the omitted copy/move
if (ConstructKind == CXXConstructExpr::CK_Complete &&
- Constructor->isCopyConstructor() && ExprArgs.size() >= 1) {
+ Constructor->isCopyOrMoveConstructor() && ExprArgs.size() >= 1) {
Expr *SubExpr = ((Expr **)ExprArgs.get())[0];
Elidable = SubExpr->isTemporaryObject(Context, Constructor->getParent());
}
Modified: cfe/trunk/test/CodeGenCXX/rvalue-references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/rvalue-references.cpp?rev=124455&r1=124454&r2=124455&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/rvalue-references.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/rvalue-references.cpp Thu Jan 27 17:24:55 2011
@@ -62,13 +62,10 @@
// CHECK: define void @_Z15elide_copy_initv
void elide_copy_init() {
ok = false;
- // FIXME: We're doing an extra move here, when we shouldn't be!
- // CHECK: call void @_Z4testv(%class.C* sret %ref.tmp)
- // CHECK: call void @_ZN1CC1EOS_(%class.C* %a, %class.C* %ref.tmp)
- // CHECK: call void @_ZN1CD1Ev(%class.C* %ref.tmp)
+ // CHECK: call void @_Z4testv
C a = test();
- // CHECK: call void @_ZN1CD1Ev(%class.C* %a)
- // CHECK: ret void
+ // CHECK-NEXT: call void @_ZN1CD1Ev
+ // CHECK-NEXT: ret void
}
// CHECK: define void @_Z16test_move_returnv
More information about the cfe-commits
mailing list