Index: include/clang/AST/TextNodeDumper.h =================================================================== --- include/clang/AST/TextNodeDumper.h +++ include/clang/AST/TextNodeDumper.h @@ -172,6 +172,8 @@ void Visit(const BlockDecl::Capture &C); + void Visit(const GenericSelectionExpr::Association &A); + 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 @@ -297,6 +297,7 @@ void VisitInitListExpr(const InitListExpr *ILE); void VisitBlockExpr(const BlockExpr *Node); void VisitOpaqueValueExpr(const OpaqueValueExpr *Node); + void Visit(const GenericSelectionExpr::Association &A); void VisitGenericSelectionExpr(const GenericSelectionExpr *E); // C++ @@ -1456,6 +1457,16 @@ dumpStmt(Source); } +void ASTDumper::Visit(const GenericSelectionExpr::Association &A) { + dumpChild([=] { + NodeDumper.Visit(A); + const TypeSourceInfo *TSI = A.getTypeSourceInfo(); + if (TSI) + dumpTypeAsChild(TSI->getType()); + dumpStmt(A.getExpr()); + }); +} + void ASTDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) { if (E->isResultDependent()) OS << " result_dependent"; @@ -1463,23 +1474,7 @@ dumpTypeAsChild(E->getControllingExpr()->getType()); // FIXME: remove for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) { - dumpChild([=] { - const auto Assoc = E->getAssociation(I); - const TypeSourceInfo *TSI = Assoc.getTypeSourceInfo(); - if (TSI) { - OS << "case "; - NodeDumper.dumpType(TSI->getType()); - } else { - OS << "default"; - } - - if (Assoc.IsSelected()) - OS << " selected"; - - if (TSI) - dumpTypeAsChild(TSI->getType()); - dumpStmt(Assoc.getExpr()); - }); + Visit(E->getAssociation(I)); } } Index: lib/AST/TextNodeDumper.cpp =================================================================== --- lib/AST/TextNodeDumper.cpp +++ lib/AST/TextNodeDumper.cpp @@ -312,6 +312,19 @@ OS << " "; } +void TextNodeDumper::Visit(const GenericSelectionExpr::Association &A) { + const TypeSourceInfo *TSI = A.getTypeSourceInfo(); + if (TSI) { + OS << "case "; + dumpType(TSI->getType()); + } else { + OS << "default"; + } + + if (A.IsSelected()) + OS << " selected"; +} + void TextNodeDumper::dumpPointer(const void *Ptr) { ColorScope Color(OS, ShowColors, AddressColor); OS << ' ' << Ptr;