[clang] [clang] Improve ast-dumper text printing of TemplateArgument (PR #93431)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Mon May 27 01:31:54 PDT 2024
================
@@ -947,6 +947,26 @@ void TextNodeDumper::dumpDeclRef(const Decl *D, StringRef Label) {
});
}
+void TextNodeDumper::dumpTemplateArgument(const TemplateArgument &TA) {
+ llvm::SmallString<128> Str;
+ {
+ llvm::raw_svector_ostream SS(Str);
+ TA.print(PrintPolicy, SS, /*IncludeType=*/true);
+ }
+ OS << " '" << Str << "'";
+
+ if (TemplateArgument CanonTA = Context->getCanonicalTemplateArgument(TA);
+ !CanonTA.structurallyEquals(TA)) {
+ llvm::SmallString<128> CanonStr;
+ {
+ llvm::raw_svector_ostream SS(CanonStr);
+ CanonTA.print(PrintPolicy, SS, /*IncludeType=*/true);
+ }
+ if (CanonStr != Str)
+ OS << ":'" << CanonStr << "'";
+ }
----------------
mizvekov wrote:
This starts showing up in tests after the improvements in https://github.com/llvm/llvm-project/pull/93433,
which is stacked on top of this PR.
Take a look at some of the modified AST tests there.
https://github.com/llvm/llvm-project/pull/93431
More information about the cfe-commits
mailing list