[clang] [clang][AST] Pretty-print default template template args (PR #162134)
Andrey Ali Khan Bolshakov via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 6 12:25:14 PDT 2025
================
@@ -1190,7 +1190,11 @@ void DeclPrinter::printTemplateParameters(const TemplateParameterList *Params,
VisitNonTypeTemplateParmDecl(NTTP);
} else if (auto TTPD = dyn_cast<TemplateTemplateParmDecl>(Param)) {
VisitTemplateDecl(TTPD);
- // FIXME: print the default argument, if present.
+ if (TTPD->hasDefaultArgument() && !TTPD->defaultArgumentWasInherited()) {
+ Out << " = ";
+ TTPD->getDefaultArgument().getArgument().print(Policy, Out,
+ /*IncludeType=*/false);
+ }
----------------
bolshakov-a wrote:
Default argument handling is similar for all the three kinds. Maybe, it should be a template method `VisitTemplateDefArg`? Or it is not justified here?
Moreover, maybe, `VisitTemplateDecl` call and the default argument handling should be united into a `VisitTemplateTemplateParmDecl` to be similar with the previous two branches?
https://github.com/llvm/llvm-project/pull/162134
More information about the cfe-commits
mailing list