Index: include/clang/AST/TextNodeDumper.h =================================================================== --- include/clang/AST/TextNodeDumper.h +++ include/clang/AST/TextNodeDumper.h @@ -169,6 +169,8 @@ void Visit(const CXXCtorInitializer *Init); + void Visit(const OMPClause *C); + void dumpPointer(const void *Ptr); void dumpLocation(SourceLocation Loc); void dumpSourceRange(SourceRange R); Index: lib/AST/ASTDumper.cpp =================================================================== --- lib/AST/ASTDumper.cpp +++ lib/AST/ASTDumper.cpp @@ -292,6 +292,7 @@ void VisitCapturedStmt(const CapturedStmt *Node); // OpenMP + void Visit(const OMPClause *C); void VisitOMPExecutableDirective(const OMPExecutableDirective *Node); // Exprs @@ -1448,29 +1449,18 @@ // 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 (auto *C : Node->clauses()) + Visit(C); } //===----------------------------------------------------------------------===// Index: lib/AST/TextNodeDumper.cpp =================================================================== --- lib/AST/TextNodeDumper.cpp +++ lib/AST/TextNodeDumper.cpp @@ -272,6 +272,24 @@ } } +void TextNodeDumper::Visit(const OMPClause *C) { + 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"; + } + dumpPointer(C); + dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc())); + if (C->isImplicit()) + OS << " "; +} + void TextNodeDumper::dumpPointer(const void *Ptr) { ColorScope Color(OS, ShowColors, AddressColor); OS << ' ' << Ptr;