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/AST/StmtPrinter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/AST/StmtPrinter.cpp') diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index b68f3a3a26e..dc4f9964c7a 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -1758,7 +1758,7 @@ void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) { break; case LCK_ByRef: - if (Node->getCaptureDefault() != LCD_ByRef || C->isInitCapture()) + if (Node->getCaptureDefault() != LCD_ByRef || Node->isInitCapture(C)) OS << '&'; OS << C->getCapturedVar()->getName(); break; @@ -1770,7 +1770,7 @@ void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) { llvm_unreachable("VLA type in explicit captures."); } - if (C->isInitCapture()) + if (Node->isInitCapture(C)) PrintExpr(C->getCapturedVar()->getInit()); } OS << ']'; -- cgit v1.2.3