[all-commits] [llvm/llvm-project] 86e385: [clang] Improve ast-dumper text printing of Templa...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Mon May 27 02:06:42 PDT 2024


  Branch: refs/heads/users/mizvekov/clang-print-canonical-ttp-templatename
  Home:   https://github.com/llvm/llvm-project
  Commit: 86e3852d0501bd24738c094359799c72781ad808
      https://github.com/llvm/llvm-project/commit/86e3852d0501bd24738c094359799c72781ad808
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/TextNodeDumper.h
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/test/AST/ast-dump-decl.cpp
    M clang/test/AST/ast-dump-openmp-begin-declare-variant_template_2.cpp
    A clang/test/AST/ast-dump-template-name.cpp
    M clang/test/AST/ast-dump-using-template.cpp
    M clang/test/AST/constraints-explicit-instantiation.cpp
    M clang/test/OpenMP/align_clause_ast_print.cpp
    M clang/test/OpenMP/generic_loop_ast_print.cpp
    M clang/test/OpenMP/interop_ast_print.cpp
    M clang/test/SemaOpenACC/sub-array-ast.cpp
    M clang/test/SemaTemplate/aggregate-deduction-candidate.cpp
    M clang/test/SemaTemplate/attributes.cpp
    M clang/test/SemaTemplate/deduction-guide.cpp
    M clang/test/SemaTemplate/make_integer_seq.cpp
    M clang/test/SemaTemplate/type_pack_element.cpp

  Log Message:
  -----------
  [clang] Improve ast-dumper text printing of TemplateArgument

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.


  Commit: 40e3c0fd00a9a3327123d43c6ad6447a14b4e543
      https://github.com/llvm/llvm-project/commit/40e3c0fd00a9a3327123d43c6ad6447a14b4e543
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/TemplateName.h
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/DeclTemplate.cpp
    M clang/lib/AST/ODRHash.cpp
    M clang/lib/AST/TemplateBase.cpp
    M clang/lib/AST/TemplateName.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaExprMember.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/test/AST/ast-dump-ctad-alias.cpp
    M clang/test/AST/ast-dump-decl.cpp
    M clang/test/AST/ast-dump-expr.cpp
    M clang/test/AST/ast-dump-template-decls.cpp
    M clang/test/AST/ast-dump-template-name.cpp
    M clang/test/AST/ast-dump-using-template.cpp
    M clang/test/CXX/drs/cwg1xx.cpp
    M clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp
    M clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
    M clang/test/Index/print-type.cpp
    M clang/test/OpenMP/declare_mapper_messages.cpp
    M clang/test/Parser/cxx-template-template-recovery.cpp
    M clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
    M clang/test/SemaTemplate/cwg2398.cpp
    M clang/test/SemaTemplate/instantiate-requires-expr.cpp
    M clang/test/SemaTemplate/nested-implicit-deduction-guides.cpp
    M clang/unittests/AST/TemplateNameTest.cpp
    M libcxx/test/std/containers/associative/map/map.cons/deduct.verify.cpp
    M libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.verify.cpp
    M libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.verify.cpp
    M libcxx/test/std/containers/associative/set/set.cons/deduct.verify.cpp
    M libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.verify.cpp
    M libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.verify.cpp
    M libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.verify.cpp
    M libcxx/test/std/containers/sequences/array/array.cons/deduct.verify.cpp
    M libcxx/test/std/containers/sequences/deque/deque.cons/deduct.verify.cpp
    M libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.verify.cpp
    M libcxx/test/std/containers/sequences/list/list.cons/deduct.verify.cpp
    M libcxx/test/std/containers/sequences/vector/vector.cons/deduct.verify.cpp
    M libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.verify.cpp
    M libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/deduct.verify.cpp
    M libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.verify.cpp
    M libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.verify.cpp
    M libcxx/test/std/ranges/range.adaptors/range.join/ctad.verify.cpp
    M libcxx/test/std/re/re.regex/re.regex.construct/deduct.verify.cpp
    M libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.verify.cpp
    M libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/deduct.verify.cpp

  Log Message:
  -----------
  [clang] Preserve Qualifiers and type sugar in TemplateNames

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.


  Commit: 7876afed3dec889805b2947e61ca10953a5a7456
      https://github.com/llvm/llvm-project/commit/7876afed3dec889805b2947e61ca10953a5a7456
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
    M clang/lib/AST/TemplateBase.cpp
    M clang/lib/AST/TemplateName.cpp
    M clang/test/SemaTemplate/deduction-guide.cpp

  Log Message:
  -----------
  [clang] fix printing of canonical template template parameters take 2

Since they can also occur as the template name of
template specializations, handle them from TemplateName
printing instead of TemplateArgument.


Compare: https://github.com/llvm/llvm-project/compare/86e3852d0501%5E...7876afed3dec

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list