diff options
author | Stephen Kelly <steveire@gmail.com> | 2019-01-15 20:41:37 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2019-01-15 20:41:37 +0000 |
commit | fbf424e10170c65a899d2acee702b27770d91601 (patch) | |
tree | 455093f147d44bfbdf38c03d5b4efa117481edd5 /clang/lib | |
parent | 7e6602110b89c066aabeb47445f17f557974eaef (diff) |
Implement BlockDecl::Capture dump in terms of visitors
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D56709
llvm-svn: 351239
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTDumper.cpp | 26 | ||||
-rw-r--r-- | clang/lib/AST/TextNodeDumper.cpp | 12 |
2 files changed, 23 insertions, 15 deletions
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp index 26e2f64d221e..852b72897606 100644 --- a/clang/lib/AST/ASTDumper.cpp +++ b/clang/lib/AST/ASTDumper.cpp @@ -283,6 +283,7 @@ namespace { void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D); void VisitObjCPropertyDecl(const ObjCPropertyDecl *D); void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D); + void Visit(const BlockDecl::Capture &C); void VisitBlockDecl(const BlockDecl *D); // Stmts. @@ -1371,6 +1372,14 @@ void ASTDumper::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) { NodeDumper.dumpDeclRef(D->getPropertyIvarDecl()); } +void ASTDumper::Visit(const BlockDecl::Capture &C) { + dumpChild([=] { + NodeDumper.Visit(C); + if (C.hasCopyExpr()) + dumpStmt(C.getCopyExpr()); + }); +} + void ASTDumper::VisitBlockDecl(const BlockDecl *D) { for (auto I : D->parameters()) dumpDecl(I); @@ -1381,21 +1390,8 @@ void ASTDumper::VisitBlockDecl(const BlockDecl *D) { if (D->capturesCXXThis()) dumpChild([=]{ OS << "capture this"; }); - for (const auto &I : D->captures()) { - dumpChild([=] { - OS << "capture"; - if (I.isByRef()) - OS << " byref"; - if (I.isNested()) - OS << " nested"; - if (I.getVariable()) { - OS << ' '; - NodeDumper.dumpBareDeclRef(I.getVariable()); - } - if (I.hasCopyExpr()) - dumpStmt(I.getCopyExpr()); - }); - } + for (const auto &I : D->captures()) + Visit(I); dumpStmt(D->getBody()); } diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp index c20e55ee8a08..b51a9006226a 100644 --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -272,6 +272,18 @@ void TextNodeDumper::Visit(const CXXCtorInitializer *Init) { } } +void TextNodeDumper::Visit(const BlockDecl::Capture &C) { + OS << "capture"; + if (C.isByRef()) + OS << " byref"; + if (C.isNested()) + OS << " nested"; + if (C.getVariable()) { + OS << ' '; + dumpBareDeclRef(C.getVariable()); + } +} + void TextNodeDumper::Visit(const OMPClause *C) { if (!C) { ColorScope Color(OS, ShowColors, NullColor); |