diff mbox series

c++: use current_template_constraints more

Message ID 20220527180552.2908794-1-ppalka@redhat.com
State New
Headers show
Series c++: use current_template_constraints more | expand

Commit Message

Patrick Palka May 27, 2022, 6:05 p.m. UTC
gcc/cp/ChangeLog:

	* decl.cc (grokvardecl): Use current_template_constraints.
	(xref_tag): Likewise.
	* semantics.cc (finish_template_template_parm): Likewise.
---
 gcc/cp/decl.cc      | 13 +++----------
 gcc/cp/semantics.cc |  3 +--
 2 files changed, 4 insertions(+), 12 deletions(-)

Comments

Jason Merrill May 29, 2022, 7:55 p.m. UTC | #1
On 5/27/22 14:05, Patrick Palka wrote:
> gcc/cp/ChangeLog:
> 
> 	* decl.cc (grokvardecl): Use current_template_constraints.
> 	(xref_tag): Likewise.
> 	* semantics.cc (finish_template_template_parm): Likewise.

OK.

> ---
>   gcc/cp/decl.cc      | 13 +++----------
>   gcc/cp/semantics.cc |  3 +--
>   2 files changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
> index 892e4a4b19b..26428ca7122 100644
> --- a/gcc/cp/decl.cc
> +++ b/gcc/cp/decl.cc
> @@ -10789,9 +10789,7 @@ grokvardecl (tree type,
>     else if (flag_concepts
>   	   && current_template_depth > template_class_depth (scope))
>       {
> -      tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
> -      tree ci = build_constraints (reqs, NULL_TREE);
> -
> +      tree ci = current_template_constraints ();
>         set_constraints (decl, ci);
>       }
>   
> @@ -15852,13 +15850,8 @@ xref_tag (enum tag_types tag_code, tree name,
>           {
>             /* Check that we aren't trying to overload a class with different
>                constraints.  */
> -          tree constr = NULL_TREE;
> -          if (current_template_parms)
> -            {
> -              tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
> -              constr = build_constraints (reqs, NULL_TREE);
> -            }
> -	  if (!redeclare_class_template (t, current_template_parms, constr))
> +	  if (!redeclare_class_template (t, current_template_parms,
> +					 current_template_constraints ()))
>   	    return error_mark_node;
>           }
>         else if (!processing_template_decl
> diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
> index cd7a2818feb..efdeb9318a7 100644
> --- a/gcc/cp/semantics.cc
> +++ b/gcc/cp/semantics.cc
> @@ -3387,8 +3387,7 @@ finish_template_template_parm (tree aggr, tree identifier)
>   
>     /* Associate the constraints with the underlying declaration,
>        not the template.  */
> -  tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
> -  tree constr = build_constraints (reqs, NULL_TREE);
> +  tree constr = current_template_constraints ();
>     set_constraints (decl, constr);
>   
>     end_template_decl ();
diff mbox series

Patch

diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 892e4a4b19b..26428ca7122 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -10789,9 +10789,7 @@  grokvardecl (tree type,
   else if (flag_concepts
 	   && current_template_depth > template_class_depth (scope))
     {
-      tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
-      tree ci = build_constraints (reqs, NULL_TREE);
-
+      tree ci = current_template_constraints ();
       set_constraints (decl, ci);
     }
 
@@ -15852,13 +15850,8 @@  xref_tag (enum tag_types tag_code, tree name,
         {
           /* Check that we aren't trying to overload a class with different
              constraints.  */
-          tree constr = NULL_TREE;
-          if (current_template_parms)
-            {
-              tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
-              constr = build_constraints (reqs, NULL_TREE);
-            }
-	  if (!redeclare_class_template (t, current_template_parms, constr))
+	  if (!redeclare_class_template (t, current_template_parms,
+					 current_template_constraints ()))
 	    return error_mark_node;
         }
       else if (!processing_template_decl
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index cd7a2818feb..efdeb9318a7 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -3387,8 +3387,7 @@  finish_template_template_parm (tree aggr, tree identifier)
 
   /* Associate the constraints with the underlying declaration,
      not the template.  */
-  tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
-  tree constr = build_constraints (reqs, NULL_TREE);
+  tree constr = current_template_constraints ();
   set_constraints (decl, constr);
 
   end_template_decl ();