3 Commits

Author SHA1 Message Date
Matheus Izvekov
3cabbf6039
[clang] text ast-dumper: dump TemplateName for TST and DTST (#93766)
Implement AST text dumping of the TemplateName for
TemplateSpecializationType and DeducedTemplateSpecializationType.
2024-05-30 04:48:45 -03:00
Matheus Izvekov
9c4a716c12
[clang] Preserve Qualifiers and type sugar in TemplateNames (#93433)
This patch improves the preservation of qualifiers and loss of type
sugar in TemplateNames.

This problem is analogous to https://reviews.llvm.org/D112374 and this
patch takes a very similar approach to that patch, except the impact
here is much lesser.

When a TemplateName was written bare, without qualifications, we
wouldn't produce a QualifiedTemplate which could be used to disambiguate
it from a Canonical TemplateName. This had effects in the TemplateName
printer, which had workarounds to deal with this, and wouldn't print the
TemplateName as-written in most situations.

There are also some related fixes to help preserve this type sugar along
the way into diagnostics, so that this patch can be properly tested.

- Fix dropping the template keyword.
- Fix type deduction to preserve sugar in TST TemplateNames.
2024-05-29 17:02:15 -03:00
Matheus Izvekov
1a2f330976
[clang] Improve ast-dumper text printing of TemplateArgument (#93431)
This improves and unifies our approach to printing all template
arguments.

The same approach to printing types is extended to all
TemplateArguments: A sugared version is printed in quotes, followed by
printing the canonical form, unless they would print the same.

Special improvements are done to add more detail to template template
arguments.

It's planned in a future patch to use this improved TemplateName printer
for other places besides TemplateArguments.

Note: The sugared/desugared printing does not show up for TemplateNames
in tests yet, because we do a poor job of preserving their type sugar.
This will be improved in a future patch.
2024-05-29 15:23:44 -03:00