aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-08-28 04:28:19 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-08-28 04:28:19 +0000
commit39c81e281629886bfa491434e31516b2056d0985 (patch)
treeb0b1ff5b7d83d851e804aad3c20379024760bb7b /clang/lib/CodeGen/CodeGenFunction.cpp
parentc5cafbb074d216d6fa6bc5beb05f236e736490d2 (diff)
downloadllvm-39c81e281629886bfa491434e31516b2056d0985.zip
llvm-39c81e281629886bfa491434e31516b2056d0985.tar.gz
llvm-39c81e281629886bfa491434e31516b2056d0985.tar.bz2
[C++11] Support for capturing of variable length arrays in lambda expression.
Differential Revision: http://reviews.llvm.org/D4368 llvm-svn: 216649
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 20e0ee7..f077a0b 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -691,6 +691,14 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
CXXThisValue = EmitLoadOfLValue(ThisLValue,
SourceLocation()).getScalarVal();
}
+ for (auto *FD : MD->getParent()->fields()) {
+ if (FD->hasCapturedVLAType()) {
+ auto *ExprArg = EmitLoadOfLValue(EmitLValueForLambdaField(FD),
+ SourceLocation()).getScalarVal();
+ auto VAT = FD->getCapturedVLAType();
+ VLASizeMap[VAT->getSizeExpr()] = ExprArg;
+ }
+ }
} else {
// Not in a lambda; just use 'this' from the method.
// FIXME: Should we generate a new load for each use of 'this'? The