diff --git a/clang/unittests/AST/ASTTraverserTest.cpp b/clang/unittests/AST/ASTTraverserTest.cpp index 69812cb8d21c16..99d4589c48a3b4 100644 --- a/clang/unittests/AST/ASTTraverserTest.cpp +++ b/clang/unittests/AST/ASTTraverserTest.cpp @@ -27,9 +27,19 @@ class NodeTreePrinter : public TextTreeStructure { NodeTreePrinter(llvm::raw_ostream &OS) : TextTreeStructure(OS, /* showColors */ false), OS(OS) {} - void Visit(const Decl *D) { OS << D->getDeclKindName() << "Decl"; } + void Visit(const Decl *D) { + OS << D->getDeclKindName() << "Decl"; + if (auto *ND = dyn_cast(D)) { + OS << " '" << ND->getDeclName() << "'"; + } + } - void Visit(const Stmt *S) { OS << S->getStmtClassName(); } + void Visit(const Stmt *S) { + OS << S->getStmtClassName(); + if (auto *E = dyn_cast(S)) { + OS << " '" << E->getDecl()->getDeclName() << "'"; + } + } void Visit(QualType QT) { OS << "QualType " << QT.split().Quals.getAsString(); @@ -147,7 +157,7 @@ void parmvardecl_attr(struct A __attribute__((address_space(19)))*); verifyWithDynNode(Func, R"cpp( -CXXMethodDecl +CXXMethodDecl 'func' |-CompoundStmt | `-ReturnStmt | `-IntegerLiteral