Remove an unsafe member variable that wasn't needed; NFC.

People use the AST dumping interface while debugging, so it's not safe to assume that a declaration will be dumped before a constant expression is dumped. This means the Context member may not get set properly and problems would happen. Rather than rely on the interface that requires the ASTContext, call the generic dump() interface instead; this allows us to remove the Context member variable.

llvm-svn: 372323
This commit is contained in:
Aaron Ballman 2019-09-19 13:51:50 +00:00
parent ed69faa01b
commit 3c3602aefa
2 changed files with 1 additions and 4 deletions

View File

@ -146,8 +146,6 @@ class TextNodeDumper
const comments::CommandTraits *Traits;
const ASTContext *Context;
const char *getCommandName(unsigned CommandID);
public:

View File

@ -223,7 +223,6 @@ void TextNodeDumper::Visit(const Decl *D) {
return;
}
Context = &D->getASTContext();
{
ColorScope Color(OS, ShowColors, DeclKindNameColor);
OS << D->getDeclKindName() << "Decl";
@ -688,7 +687,7 @@ void TextNodeDumper::VisitConstantExpr(const ConstantExpr *Node) {
if (Node->getResultAPValueKind() != APValue::None) {
ColorScope Color(OS, ShowColors, ValueColor);
OS << " ";
Node->getAPValueResult().printPretty(OS, *Context, Node->getType());
Node->getAPValueResult().dump(OS);
}
}