[cfe-commits] r88662 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGenCXX/temporaries.cpp
Anders Carlsson
andersca at mac.com
Fri Nov 13 09:04:36 PST 2009
Author: andersca
Date: Fri Nov 13 11:04:35 2009
New Revision: 88662
URL: http://llvm.org/viewvc/llvm-project?rev=88662&view=rev
Log:
Don't bind arguments to temporaries if the argument has a reference type.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CodeGenCXX/temporaries.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=88662&r1=88661&r2=88662&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Nov 13 11:04:35 2009
@@ -2653,7 +2653,8 @@
if (PerformCopyInitialization(Arg, ProtoArgType, "passing"))
return true;
- Arg = MaybeBindToTemporary(Arg).takeAs<Expr>();
+ if (!ProtoArgType->isReferenceType())
+ Arg = MaybeBindToTemporary(Arg).takeAs<Expr>();
} else {
ParmVarDecl *Param = FDecl->getParamDecl(i);
Modified: cfe/trunk/test/CodeGenCXX/temporaries.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/temporaries.cpp?rev=88662&r1=88661&r2=88662&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/temporaries.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/temporaries.cpp Fri Nov 13 11:04:35 2009
@@ -188,3 +188,17 @@
// CHECK: call void @_ZN1HD1Ev
f9(h);
}
+
+void f10(const H&);
+
+void f11(H h) {
+ // CHECK: call void @_ZN1HC1Ev
+ // CHECK: call void @_Z3f10RK1H
+ // CHECK: call void @_ZN1HD1Ev
+ f10(H());
+
+ // CHECK: call void @_Z3f10RK1H
+ // CHECK-NOT: call void @_ZN1HD1Ev
+ // CHECK: ret void
+ f10(h);
+}
\ No newline at end of file
More information about the cfe-commits
mailing list