From 5110ebd9fe5f3c4d6714b6b01635f8f211786808 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 llvm-svn: 351600 --- clang/lib/AST/ASTDumper.cpp | 6 +++--- clang/test/AST/ast-dump-decl.mm | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp index b99ed3b286bc..e2390baa7a4b 100644 --- a/clang/lib/AST/ASTDumper.cpp +++ b/clang/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/clang/test/AST/ast-dump-decl.mm b/clang/test/AST/ast-dump-decl.mm index d18e56c939d9..efe356886a93 100644 --- a/clang/test/AST/ast-dump-decl.mm +++ b/clang/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