From dd2ffea28893a3bb59c3e46baddec631bdc68462 Mon Sep 17 00:00:00 2001 From: James Dennett Date: Thu, 7 May 2015 18:48:18 +0000 Subject: Replace the broken LambdaCapture::isInitCapture API. A LambdaCapture does not have sufficient information to correctly determine whether it is an init-capture or not. Doing so requires knowledge held in the LambdaExpr itself. It the case of a nested capture of an init-capture it is not sufficient to check (as LambdaCapture::isInitCapture did) whether the associated VarDecl was from an init-capture. This patch moves isInitCapture to LambdaExpr and updates Capture->isInitCapture() to Lambda->isInitCapture(Capture). llvm-svn: 236760 --- clang/lib/Sema/TreeTransform.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/Sema/TreeTransform.h') diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 704cef36d44..f5249fdeb01 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -9133,7 +9133,7 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { for (LambdaExpr::capture_iterator C = E->capture_begin(), CEnd = E->capture_end(); C != CEnd; ++C) { - if (!C->isInitCapture()) + if (!E->isInitCapture(C)) continue; EnterExpressionEvaluationContext EEEC(getSema(), Sema::PotentiallyEvaluated); @@ -9245,7 +9245,7 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { continue; // Rebuild init-captures, including the implied field declaration. - if (C->isInitCapture()) { + if (E->isInitCapture(C)) { InitCaptureInfoTy InitExprTypePair = InitCaptureExprsAndTypes[C - E->capture_begin()]; ExprResult Init = InitExprTypePair.first; -- cgit v1.2.3