A little bit of lambda IRGen.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150058 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 00f4744..49d85f7 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -686,6 +686,8 @@
     return EmitCXXConstructLValue(cast<CXXConstructExpr>(E));
   case Expr::CXXBindTemporaryExprClass:
     return EmitCXXBindTemporaryLValue(cast<CXXBindTemporaryExpr>(E));
+  case Expr::LambdaExprClass:
+    return EmitLambdaLValue(cast<LambdaExpr>(E));
 
   case Expr::ExprWithCleanupsClass: {
     const ExprWithCleanups *cleanups = cast<ExprWithCleanups>(E);
@@ -2359,6 +2361,15 @@
   return MakeAddrLValue(Slot.getAddr(), E->getType());
 }
 
+LValue
+CodeGenFunction::EmitLambdaLValue(const LambdaExpr *E) {
+  if (E->capture_begin() != E->capture_end())
+    return EmitUnsupportedLValue(E, "lambda expression");
+
+  AggValueSlot Slot = CreateAggTemp(E->getType(), "temp.lvalue");
+  return MakeAddrLValue(Slot.getAddr(), E->getType());
+}
+
 LValue CodeGenFunction::EmitObjCMessageExprLValue(const ObjCMessageExpr *E) {
   RValue RV = EmitObjCMessageExpr(E);
   
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index e105f31..2c61d22 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -2117,6 +2117,7 @@
 
   LValue EmitCXXConstructLValue(const CXXConstructExpr *E);
   LValue EmitCXXBindTemporaryLValue(const CXXBindTemporaryExpr *E);
+  LValue EmitLambdaLValue(const LambdaExpr *E);
   LValue EmitCXXTypeidLValue(const CXXTypeidExpr *E);
 
   LValue EmitObjCMessageExprLValue(const ObjCMessageExpr *E);