From d87b091f165b7fd10948b288e84c5a4e0a00f981 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 18 Jan 2019 21:55:24 +0000 Subject: [PATCH] [ASTDump] Mark BlockDecls which capture this with a tag Summary: Removal of the child node makes it easier to separate traversal from output generation. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56752 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351600 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTDumper.cpp | 6 +++--- test/AST/ast-dump-decl.mm | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index b99ed3b286..e2390baa7a 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -1379,12 +1379,12 @@ void ASTDumper::VisitBlockDecl(const BlockDecl *D) { if (D->isVariadic()) OS << " variadic"; + if (D->capturesCXXThis()) + OS << " captures_this"; + for (auto I : D->parameters()) dumpDecl(I); - if (D->capturesCXXThis()) - dumpChild([=]{ OS << "capture this"; }); - for (const auto &I : D->captures()) Visit(I); dumpStmt(D->getBody()); diff --git a/test/AST/ast-dump-decl.mm b/test/AST/ast-dump-decl.mm index d18e56c939..efe356886a 100644 --- a/test/AST/ast-dump-decl.mm +++ b/test/AST/ast-dump-decl.mm @@ -39,8 +39,7 @@ struct Test { // CHECK-NEXT: cleanup Block // CHECK-NEXT: CallExpr {{.*}} 'void' // CHECK-NEXT: BlockExpr {{.*}} 'void (^)()' - // CHECK-NEXT: BlockDecl {{.*}} col:5 - // CHECK-NEXT: capture this + // CHECK-NEXT: BlockDecl {{.*}} col:5 captures_this // CHECK-NEXT: CompoundStmt {{.*}} // CHECK-NEXT: CXXMemberCallExpr {{.*}} 'void' // CHECK-NEXT: MemberExpr {{.*}} '' ->yada -- 2.40.0