[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:35:56 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 << "'";
----------------
mizvekov wrote:

Yeah, the quotes are what we already do for types, and I think the problem shows up there, though of course not as self-evident as here.

I don't think there is a formal solution besides to start escaping the string.

https://github.com/llvm/llvm-project/pull/93431


More information about the cfe-commits mailing list