[cfe-commits] r79171 - in /cfe/trunk: lib/AST/Expr.cpp lib/Sema/SemaOverload.cpp test/CodeGenCXX/temp-1.cpp
Anders Carlsson
andersca at mac.com
Sat Aug 15 20:42:14 PDT 2009
Author: andersca
Date: Sat Aug 15 22:42:12 2009
New Revision: 79171
URL: http://llvm.org/viewvc/llvm-project?rev=79171&view=rev
Log:
Add MaybeBindToTemporary calls for member call expressions.
Modified:
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/CodeGenCXX/temp-1.cpp
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=79171&r1=79170&r2=79171&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sat Aug 15 22:42:12 2009
@@ -800,6 +800,9 @@
case CXXTypeidExprClass:
// C++ 5.2.8p1: The result of a typeid expression is an lvalue of ...
return LV_Valid;
+ case CXXBindTemporaryExprClass:
+ return cast<CXXBindTemporaryExpr>(this)->getSubExpr()->
+ isLvalueInternal(Ctx);
case ConditionalOperatorClass: {
// Complicated handling is only for C++.
if (!Ctx.getLangOptions().CPlusPlus)
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=79171&r1=79170&r2=79171&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sat Aug 15 22:42:12 2009
@@ -4345,8 +4345,8 @@
if (CheckFunctionCall(Method, TheCall.get()))
return true;
-
- return TheCall.release();
+
+ return MaybeBindToTemporary(TheCall.release()).release();
}
/// BuildCallToObjectOfClassType - Build a call to an object of class
Modified: cfe/trunk/test/CodeGenCXX/temp-1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/temp-1.cpp?rev=79171&r1=79170&r2=79171&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/temp-1.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/temp-1.cpp Sat Aug 15 22:42:12 2009
@@ -12,7 +12,7 @@
A().f();
}
-// Calls
+// Function calls
struct B {
B();
~B();
@@ -21,8 +21,24 @@
B g();
// RUN: grep "call void @_ZN1BC1Ev" %t | count 0 &&
-// RUN: grep "call void @_ZN1BD1Ev" %t | count 1
+// RUN: grep "call void @_ZN1BD1Ev" %t | count 1 &&
void f2() {
(void)g();
}
+// Member function calls
+struct C {
+ C();
+ ~C();
+
+ C f();
+};
+
+// RUN: grep "call void @_ZN1CC1Ev" %t | count 1 &&
+// RUN: grep "call void @_ZN1CD1Ev" %t | count 2
+void f3() {
+ C().f();
+}
+
+
+
More information about the cfe-commits
mailing list