diff --git a/clang/include/clang/AST/TextNodeDumper.h b/clang/include/clang/AST/TextNodeDumper.h index 0ff5a614a864..4c2d0710963b 100644 --- a/clang/include/clang/AST/TextNodeDumper.h +++ b/clang/include/clang/AST/TextNodeDumper.h @@ -146,6 +146,8 @@ class TextNodeDumper const comments::CommandTraits *Traits; + const ASTContext *Context; + const char *getCommandName(unsigned CommandID); public: diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp index 546a62cda28b..df3d149f2978 100644 --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -223,6 +223,7 @@ void TextNodeDumper::Visit(const Decl *D) { return; } + Context = &D->getASTContext(); { ColorScope Color(OS, ShowColors, DeclKindNameColor); OS << D->getDeclKindName() << "Decl"; @@ -687,7 +688,7 @@ void TextNodeDumper::VisitConstantExpr(const ConstantExpr *Node) { if (Node->getResultAPValueKind() != APValue::None) { ColorScope Color(OS, ShowColors, ValueColor); OS << " "; - Node->getAPValueResult().dump(OS); + Node->getAPValueResult().printPretty(OS, *Context, Node->getType()); } }