[clang] [Clang] Unify interface for accessing template arguments as written for class/variable template specializations (PR #81642)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 1 08:42:07 PDT 2024
================
@@ -1455,21 +1455,17 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream &OS) {
// If this is a class template specialization, print the template
// arguments.
- if (const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
- ArrayRef<TemplateArgument> Args;
- TypeSourceInfo *TAW = Spec->getTypeAsWritten();
- if (!Policy.PrintCanonicalTypes && TAW) {
- const TemplateSpecializationType *TST =
- cast<TemplateSpecializationType>(TAW->getType());
- Args = TST->template_arguments();
- } else {
- const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
- Args = TemplateArgs.asArray();
- }
+ if (auto S = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
+ const TemplateParameterList *TParams =
+ S->getSpecializedTemplate()->getTemplateParameters();
+ const auto *TArgAsWritten = S->getTemplateArgsAsWritten();
----------------
erichkeane wrote:
By coding standard, we can't really use 'auto' here IIRC.
https://github.com/llvm/llvm-project/pull/81642
More information about the cfe-commits
mailing list