]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: use TREE_VEC for trailing args of variadic built-in traits
authorPatrick Palka <ppalka@redhat.com>
Thu, 20 Apr 2023 19:00:06 +0000 (15:00 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 20 Apr 2023 19:00:06 +0000 (15:00 -0400)
commit76fa66ea397cb255ab1d68a90ff6b878236e9620
tree795c8642211cb1ac46c5fa5fdd5e421ea710fd3a
parentd180a5524ccdab8ef839ee55efecf60ce5b0240b
c++: use TREE_VEC for trailing args of variadic built-in traits

This patch makes us use TREE_VEC instead of TREE_LIST to represent the
trailing arguments of a variadic built-in trait.  These built-ins are
typically passed a simple pack expansion as the second argument, e.g.

   __is_constructible(T, Ts...)

and the main benefit of this representation change is that substituting
into this argument list is now basically free since tsubst_template_args
makes sure we reuse the TREE_VEC of the corresponding ARGUMENT_PACK when
expanding such a pack expansion.  In the previous TREE_LIST representation
we would need need to convert the expanded pack expansion into a TREE_LIST
(via tsubst_tree_list).

Note that an empty set of trailing arguments is now represented as an
empty TREE_VEC instead of NULL_TREE, so now TRAIT_TYPE/EXPR_TYPE2 will
be empty only for unary traits.

gcc/cp/ChangeLog:

* constraint.cc (diagnose_trait_expr): Convert a TREE_VEC
of arguments into a TREE_LIST for sake of pretty printing.
* cxx-pretty-print.cc (pp_cxx_trait): Handle TREE_VEC
instead of TREE_LIST of trailing variadic trait arguments.
* method.cc (constructible_expr): Likewise.
(is_xible_helper): Likewise.
* parser.cc (cp_parser_trait): Represent trailing variadic trait
arguments as a TREE_VEC instead of TREE_LIST.
* pt.cc (value_dependent_expression_p): Handle TREE_VEC
instead of TREE_LIST of trailing variadic trait arguments.
* semantics.cc (finish_type_pack_element): Likewise.
(check_trait_type): Likewise.
gcc/cp/constraint.cc
gcc/cp/cxx-pretty-print.cc
gcc/cp/method.cc
gcc/cp/parser.cc
gcc/cp/pt.cc
gcc/cp/semantics.cc