[cfe-commits] r170160 - in /cfe/trunk: lib/CodeGen/CGClass.cpp test/CodeGenCXX/lambda-expressions.cpp
Eli Friedman
eli.friedman at gmail.com
Thu Dec 13 15:37:17 PST 2012
Author: efriedma
Date: Thu Dec 13 17:37:17 2012
New Revision: 170160
URL: http://llvm.org/viewvc/llvm-project?rev=170160&view=rev
Log:
Make sure the __invoke function for lambdas returns properly. Per bug report on IRC>
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/test/CodeGenCXX/lambda-expressions.cpp
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=170160&r1=170159&r2=170160&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Thu Dec 13 17:37:17 2012
@@ -1787,6 +1787,8 @@
// If necessary, copy the returned value into the slot.
if (!resultType->isVoidType() && returnSlot.isNull())
EmitReturnOfRValue(RV, resultType);
+ else
+ EmitBranchThroughCleanup(ReturnBlock);
}
void CodeGenFunction::EmitLambdaBlockInvokeBody() {
Modified: cfe/trunk/test/CodeGenCXX/lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/lambda-expressions.cpp?rev=170160&r1=170159&r2=170160&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/lambda-expressions.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/lambda-expressions.cpp Thu Dec 13 17:37:17 2012
@@ -80,6 +80,15 @@
return [] { return r; } ();
};
+// CHECK: define internal void @"_ZZ1hvEN3$_78__invokeEv"(%struct.A* noalias sret %agg.result)
+// CHECK-NEXT: entry:
+// CHECK-NEXT: call void @"_ZZ1hvENK3$_7clEv"(%struct.A* sret %agg.result,
+// CHECK-NEXT: ret void
+struct A { ~A(); };
+void h() {
+ A (*h)() = [] { return A(); };
+}
+
// CHECK: define internal i32 @"_ZZ1fvEN3$_58__invokeEii"
// CHECK: store i32
// CHECK-NEXT: store i32
More information about the cfe-commits
mailing list