c++: Simplify constraint normalization routines
authorPatrick Palka <ppalka@redhat.com>
Thu, 29 Oct 2020 18:03:03 +0000 (14:03 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 29 Oct 2020 18:03:03 +0000 (14:03 -0400)
commite1344fe7b6a96966281c78e46e777b456d5c2e19
treed45435956b4ad7f23fd050b8ba375e61372f1990
parent5681668765e233735b4c5e6a305e73ae1f80a328
c++: Simplify constraint normalization routines

Many of the high-level constraint normalization routines allow the
caller to supply the initial template arguments for normalization, but
in practice all of the callers supply something equivalent to the
identity mapping(*).

This patch hard-codes this prevalent choice of initial template
arguments by making get_normalized_constraints always pass NULL_TREE as
the args to normalize_expression.  This admits some simplifications in
the high-level routines, such as removing their 'args' parameter and
consolidating the two versions of normalize_constraint_expression.

(*): In particular, a set of generic template arguments or NULL_TREE.
In the case of the two-parm version of normalize_constraint_expression,
we were suspiciously using the template arguments of a concept-id when
normalizing the concept-id as a constraint-expression.

gcc/cp/ChangeLog:

* constraint.cc (get_normalized_constraints): Remove 'args'
parameter.  Pass NULL_TREE as the initial template arguments to
normalize_expression.
(get_normalized_constraints_from_info): Remove 'args' parameter
and adjust the call to get_normalized_constraints.
(get_normalized_constraints_from_decl): Remove 'args' local
variable and adjust call to get_normalized_constraints_from_info.
(normalize_concept_definition): Remove 'args' local variable
and adjust call to get_normalized_constraints.
(normalize_constraint_expression): Remove the two-parameter
overload.  Remove 'args' parameter from the three-parameter
overload and update function comment accordingly.  Remove
default argument from 'diag' parameter.  Adjust call to
get_normalized_constraints.
(finish_nested_requirement): Adjust call to
normalize_constraint_expression.
(strictly_subsumes): Remove 'args' parameter.  Adjust call to
get_normalized_constraints_from_info.
(weakly_subsumes): Likewise.
* cp-tree.h (strictly_subsumes): Remove 'args' parameter.
(weakly_subsumes): Likewise.
* pt.c (process_partial_specialization): Adjust call to
strictly_subsumes.
(is_compatible_template_arg): Adjust call to weakly_subsumes.
gcc/cp/constraint.cc
gcc/cp/cp-tree.h
gcc/cp/pt.c