diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 00f4744ef43a..49d85f7b8150 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -686,6 +686,8 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) { return EmitCXXConstructLValue(cast(E)); case Expr::CXXBindTemporaryExprClass: return EmitCXXBindTemporaryLValue(cast(E)); + case Expr::LambdaExprClass: + return EmitLambdaLValue(cast(E)); case Expr::ExprWithCleanupsClass: { const ExprWithCleanups *cleanups = cast(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); diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index e105f31f0f2e..2c61d22f3491 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -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);