summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-02-08 05:34:55 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-02-08 05:34:55 +0000
commit5bc1712940fb7b88aae6ba46766567c9c886a1f8 (patch)
tree8d929e92dfe8a8b97b91dd95c79df7d46c32a8e1 /clang/lib/CodeGen
parente6bc6cb96fbcbd77a80c8cb831a2bba2b4073cac (diff)
downloadbcm5719-llvm-5bc1712940fb7b88aae6ba46766567c9c886a1f8.tar.gz
bcm5719-llvm-5bc1712940fb7b88aae6ba46766567c9c886a1f8.zip
A little bit of lambda IRGen.
llvm-svn: 150058
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp11
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 00f4744ef43..49d85f7b815 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<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);
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index e105f31f0f2..2c61d22f349 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);
OpenPOWER on IntegriCloud