[C++11] Support for capturing of variable length arrays in lambda expression.

Differential Revision: http://reviews.llvm.org/D4368

llvm-svn: 216649
This commit is contained in:
Alexey Bataev
2014-08-28 04:28:19 +00:00
parent c5cafbb074
commit 39c81e2816
23 changed files with 375 additions and 56 deletions

View File

@@ -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