aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLambda.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-13 16:35:30 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-13 16:35:30 +0000
commit9daa7bfdff7256cef693d7bf10084881bcb9253c (patch)
tree8902ff401da72f1c89e61f0f6dcf47dfb0088b5c /lib/Sema/SemaLambda.cpp
parent3b66d7b73536ccf8612504f1edb56fa360a73947 (diff)
Keep track of the set of array index variables we use when we
synthesize a by-copy captured array in a lambda. This information will be needed by IR generation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLambda.cpp')
-rw-r--r--lib/Sema/SemaLambda.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp
index 44b388364a..f91b93f957 100644
--- a/lib/Sema/SemaLambda.cpp
+++ b/lib/Sema/SemaLambda.cpp
@@ -306,6 +306,8 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc,
SourceRange IntroducerRange;
bool ExplicitParams;
bool LambdaExprNeedsCleanups;
+ llvm::SmallVector<VarDecl *, 4> ArrayIndexVars;
+ llvm::SmallVector<unsigned, 4> ArrayIndexStarts;
{
LambdaScopeInfo *LSI = getCurLambda();
CallOperator = LSI->CallOperator;
@@ -313,7 +315,9 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc,
IntroducerRange = LSI->IntroducerRange;
ExplicitParams = LSI->ExplicitParams;
LambdaExprNeedsCleanups = LSI->ExprNeedsCleanups;
-
+ ArrayIndexVars.swap(LSI->ArrayIndexVars);
+ ArrayIndexStarts.swap(LSI->ArrayIndexStarts);
+
// Translate captures.
for (unsigned I = 0, N = LSI->Captures.size(); I != N; ++I) {
LambdaScopeInfo::Capture From = LSI->Captures[I];
@@ -467,6 +471,7 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc,
LambdaExpr *Lambda = LambdaExpr::Create(Context, Class, IntroducerRange,
CaptureDefault, Captures,
ExplicitParams, CaptureInits,
+ ArrayIndexVars, ArrayIndexStarts,
Body->getLocEnd());
// C++11 [expr.prim.lambda]p2: