r352552 - NFC: Implement GenericSelectionExpr::Association dump with Visitor
Stephen Kelly via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 29 14:22:55 PST 2019
Author: steveire
Date: Tue Jan 29 14:22:55 2019
New Revision: 352552
URL: http://llvm.org/viewvc/llvm-project?rev=352552&view=rev
Log:
NFC: Implement GenericSelectionExpr::Association dump with Visitor
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D56960
Modified:
cfe/trunk/include/clang/AST/TextNodeDumper.h
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/TextNodeDumper.cpp
Modified: cfe/trunk/include/clang/AST/TextNodeDumper.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TextNodeDumper.h?rev=352552&r1=352551&r2=352552&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TextNodeDumper.h (original)
+++ cfe/trunk/include/clang/AST/TextNodeDumper.h Tue Jan 29 14:22:55 2019
@@ -172,6 +172,8 @@ public:
void Visit(const BlockDecl::Capture &C);
+ void Visit(const GenericSelectionExpr::ConstAssociation &A);
+
void dumpPointer(const void *Ptr);
void dumpLocation(SourceLocation Loc);
void dumpSourceRange(SourceRange R);
Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=352552&r1=352551&r2=352552&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Tue Jan 29 14:22:55 2019
@@ -297,6 +297,7 @@ namespace {
void VisitInitListExpr(const InitListExpr *ILE);
void VisitBlockExpr(const BlockExpr *Node);
void VisitOpaqueValueExpr(const OpaqueValueExpr *Node);
+ void Visit(const GenericSelectionExpr::ConstAssociation &A);
void VisitGenericSelectionExpr(const GenericSelectionExpr *E);
// C++
@@ -1456,6 +1457,15 @@ void ASTDumper::VisitOpaqueValueExpr(con
dumpStmt(Source);
}
+void ASTDumper::Visit(const GenericSelectionExpr::ConstAssociation &A) {
+ dumpChild([=] {
+ NodeDumper.Visit(A);
+ if (const TypeSourceInfo *TSI = A.getTypeSourceInfo())
+ dumpTypeAsChild(TSI->getType());
+ dumpStmt(A.getAssociationExpr());
+ });
+}
+
void ASTDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
if (E->isResultDependent())
OS << " result_dependent";
@@ -1463,21 +1473,7 @@ void ASTDumper::VisitGenericSelectionExp
dumpTypeAsChild(E->getControllingExpr()->getType()); // FIXME: remove
for (const auto &Assoc : E->associations()) {
- dumpChild([=] {
- if (const TypeSourceInfo *TSI = Assoc.getTypeSourceInfo()) {
- OS << "case ";
- NodeDumper.dumpType(TSI->getType());
- } else {
- OS << "default";
- }
-
- if (Assoc.isSelected())
- OS << " selected";
-
- if (const TypeSourceInfo *TSI = Assoc.getTypeSourceInfo())
- dumpTypeAsChild(TSI->getType());
- dumpStmt(Assoc.getAssociationExpr());
- });
+ Visit(Assoc);
}
}
Modified: cfe/trunk/lib/AST/TextNodeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TextNodeDumper.cpp?rev=352552&r1=352551&r2=352552&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TextNodeDumper.cpp (original)
+++ cfe/trunk/lib/AST/TextNodeDumper.cpp Tue Jan 29 14:22:55 2019
@@ -312,6 +312,19 @@ void TextNodeDumper::Visit(const OMPClau
OS << " <implicit>";
}
+void TextNodeDumper::Visit(const GenericSelectionExpr::ConstAssociation &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;
More information about the cfe-commits
mailing list