]> granicus.if.org Git - clang/commitdiff
A little bit of lambda IRGen.
authorEli Friedman <eli.friedman@gmail.com>
Wed, 8 Feb 2012 05:34:55 +0000 (05:34 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 8 Feb 2012 05:34:55 +0000 (05:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150058 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.h

index 00f4744ef43a6cbddc687b5622bb06df2b9ddbe4..49d85f7b81508e639fabf6c66e2e779e716a3895 100644 (file)
@@ -686,6 +686,8 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
     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 @@ CodeGenFunction::EmitCXXBindTemporaryLValue(const CXXBindTemporaryExpr *E) {
   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);
   
index e105f31f0f2ed768c00eda134216fe82138f90b0..2c61d22f34913f44833cee10b215e9e71549750f 100644 (file)
@@ -2117,6 +2117,7 @@ public:
 
   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);