[llvm-branch-commits] [clang] [clang] implement printing of canonical template arguments of expression kind (PR #135133)

Matheus Izvekov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Apr 10 08:51:42 PDT 2025


================
@@ -1305,9 +1305,13 @@ void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
     Qualifier->print(OS, Policy);
   if (Node->hasTemplateKeyword())
     OS << "template ";
+
+  bool ForceAnonymous =
+      Policy.PrintAsCanonical && VD->getKind() == Decl::NonTypeTemplateParm;
----------------
mizvekov wrote:

Yeah, canonicalization of expressions should erase the identity of any NTTPs referenced therein, which should make them print as 'value-parameter-X-X', as if the NTTP was anonymous, and similarly to how it happens with regards to types and type template parameters.

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


More information about the llvm-branch-commits mailing list