mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 22:36:06 +00:00
[clang] NFCI: improve TemplateArgument and TemplateName dump methods (#94905)
These will work as AST Text node dumpers, as usual, instead of AST printers. Note that for now, the TemplateName dumper is using the TemplateArgument dumper through an implicit conversion. This can be fixed in a later pass.
This commit is contained in:
parent
97cfe549c9
commit
3f6fe4efbe
@ -459,7 +459,7 @@ public:
|
||||
bool IncludeType) const;
|
||||
|
||||
/// Debugging aid that dumps the template argument.
|
||||
void dump(raw_ostream &Out) const;
|
||||
void dump(raw_ostream &Out, const ASTContext &Context) const;
|
||||
|
||||
/// Debugging aid that dumps the template argument to standard error.
|
||||
void dump() const;
|
||||
|
@ -340,7 +340,7 @@ public:
|
||||
Qualified Qual = Qualified::AsWritten) const;
|
||||
|
||||
/// Debugging aid that dumps the template name.
|
||||
void dump(raw_ostream &OS) const;
|
||||
void dump(raw_ostream &OS, const ASTContext &Context) const;
|
||||
|
||||
/// Debugging aid that dumps the template name to standard
|
||||
/// error.
|
||||
|
@ -360,3 +360,37 @@ LLVM_DUMP_METHOD void ConceptReference::dump(raw_ostream &OS) const {
|
||||
ASTDumper P(OS, Ctx, Ctx.getDiagnostics().getShowColors());
|
||||
P.Visit(this);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TemplateName method implementations
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// FIXME: These are actually using the TemplateArgument dumper, through
|
||||
// an implicit conversion. The dump will claim this is a template argument,
|
||||
// which is misleading.
|
||||
|
||||
LLVM_DUMP_METHOD void TemplateName::dump() const {
|
||||
ASTDumper Dumper(llvm::errs(), /*ShowColors=*/false);
|
||||
Dumper.Visit(*this);
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD void TemplateName::dump(llvm::raw_ostream &OS,
|
||||
const ASTContext &Context) const {
|
||||
ASTDumper Dumper(OS, Context, Context.getDiagnostics().getShowColors());
|
||||
Dumper.Visit(*this);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TemplateArgument method implementations
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
LLVM_DUMP_METHOD void TemplateArgument::dump() const {
|
||||
ASTDumper Dumper(llvm::errs(), /*ShowColors=*/false);
|
||||
Dumper.Visit(*this);
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD void TemplateArgument::dump(llvm::raw_ostream &OS,
|
||||
const ASTContext &Context) const {
|
||||
ASTDumper Dumper(OS, Context, Context.getDiagnostics().getShowColors());
|
||||
Dumper.Visit(*this);
|
||||
}
|
||||
|
@ -577,15 +577,6 @@ void TemplateArgument::print(const PrintingPolicy &Policy, raw_ostream &Out,
|
||||
}
|
||||
}
|
||||
|
||||
void TemplateArgument::dump(raw_ostream &Out) const {
|
||||
LangOptions LO; // FIXME! see also TemplateName::dump().
|
||||
LO.CPlusPlus = true;
|
||||
LO.Bool = true;
|
||||
print(PrintingPolicy(LO), Out, /*IncludeType*/ true);
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD void TemplateArgument::dump() const { dump(llvm::errs()); }
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TemplateArgumentLoc Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -360,14 +360,3 @@ const StreamingDiagnostic &clang::operator<<(const StreamingDiagnostic &DB,
|
||||
OS.flush();
|
||||
return DB << NameStr;
|
||||
}
|
||||
|
||||
void TemplateName::dump(raw_ostream &OS) const {
|
||||
LangOptions LO; // FIXME!
|
||||
LO.CPlusPlus = true;
|
||||
LO.Bool = true;
|
||||
print(OS, PrintingPolicy(LO));
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD void TemplateName::dump() const {
|
||||
dump(llvm::errs());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user