r351600 - [ASTDump] Mark BlockDecls which capture this with a tag

Stephen Kelly via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 18 13:55:24 PST 2019


Author: steveire
Date: Fri Jan 18 13:55:24 2019
New Revision: 351600

URL: http://llvm.org/viewvc/llvm-project?rev=351600&view=rev
Log:
[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

Modified:
    cfe/trunk/lib/AST/ASTDumper.cpp
    cfe/trunk/test/AST/ast-dump-decl.mm

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351600&r1=351599&r2=351600&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Fri Jan 18 13:55:24 2019
@@ -1379,12 +1379,12 @@ void ASTDumper::VisitBlockDecl(const Blo
   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());

Modified: cfe/trunk/test/AST/ast-dump-decl.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/ast-dump-decl.mm?rev=351600&r1=351599&r2=351600&view=diff
==============================================================================
--- cfe/trunk/test/AST/ast-dump-decl.mm (original)
+++ cfe/trunk/test/AST/ast-dump-decl.mm Fri Jan 18 13:55:24 2019
@@ -39,8 +39,7 @@ struct Test {
     // CHECK-NEXT:   cleanup Block
     // CHECK-NEXT:   CallExpr {{.*}} <col:5, col:24> 'void'
     // CHECK-NEXT:     BlockExpr {{.*}} <col:5, col:22> 'void (^)()'
-    // CHECK-NEXT:       BlockDecl {{.*}} <col:5, col:22> col:5
-    // CHECK-NEXT:         capture this
+    // CHECK-NEXT:       BlockDecl {{.*}} <col:5, col:22> col:5 captures_this
     // CHECK-NEXT:         CompoundStmt {{.*}} <col:6, col:22>
     // CHECK-NEXT:           CXXMemberCallExpr {{.*}} <col:8, col:19> 'void'
     // CHECK-NEXT:             MemberExpr {{.*}} <col:8, col:14> '<bound member function type>' ->yada




More information about the cfe-commits mailing list