From 3cdd1a7d47f3a51c67979d28ce542a2f03c12d0c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 15 Jan 2019 20:31:31 +0000 Subject: NFC: Implement OMPClause dump in terms of visitors Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56708 llvm-svn: 351236 --- clang/lib/AST/ASTDumper.cpp | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'clang/lib/AST/ASTDumper.cpp') diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp index 49774aabdfb..26e2f64d221 100644 --- a/clang/lib/AST/ASTDumper.cpp +++ b/clang/lib/AST/ASTDumper.cpp @@ -292,6 +292,7 @@ namespace { void VisitCapturedStmt(const CapturedStmt *Node); // OpenMP + void Visit(const OMPClause *C); void VisitOMPExecutableDirective(const OMPExecutableDirective *Node); // Exprs @@ -1448,29 +1449,18 @@ void ASTDumper::VisitCapturedStmt(const CapturedStmt *Node) { // OpenMP dumping methods. //===----------------------------------------------------------------------===// +void ASTDumper::Visit(const OMPClause *C) { + dumpChild([=] { + NodeDumper.Visit(C); + for (auto *S : C->children()) + dumpStmt(S); + }); +} + void ASTDumper::VisitOMPExecutableDirective( const OMPExecutableDirective *Node) { - for (auto *C : Node->clauses()) { - dumpChild([=] { - if (!C) { - ColorScope Color(OS, ShowColors, NullColor); - OS << "<<>> OMPClause"; - return; - } - { - ColorScope Color(OS, ShowColors, AttrColor); - StringRef ClauseName(getOpenMPClauseName(C->getClauseKind())); - OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper() - << ClauseName.drop_front() << "Clause"; - } - NodeDumper.dumpPointer(C); - NodeDumper.dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc())); - if (C->isImplicit()) - OS << " "; - for (auto *S : C->children()) - dumpStmt(S); - }); - } + for (const auto *C : Node->clauses()) + Visit(C); } //===----------------------------------------------------------------------===// -- cgit v1.2.3