Patchwork [C++] Use TYPE_ALIAS_P, COMPLETE_OR_OPEN_TYPE_P, TYPE_TI_ARGS

login
register
mail settings
Submitter Paolo Carlini
Date April 2, 2013, 1:34 p.m.
Message ID <515ADE66.5090007@oracle.com>
Download mbox | patch
Permalink /patch/232994/
State New
Headers show

Comments

Paolo Carlini - April 2, 2013, 1:34 p.m.
Hi,

I think this is my last obvious clean-up for now. I'm going to commit it 
when testing on x86_64-linux completes.

Thanks,
Paolo.

//////////////////////
2013-04-02  Paolo Carlini  <paolo.carlini@oracle.com>

	* friend.c (do_friend): Use COMPLETE_OR_OPEN_TYPE_P.
	* pt.c (find_parameter_packs_r): Use TYPE_ALIAS_P and TYPE_TI_ARGS.
	(for_each_template_parm_r): Use TYPE_TI_ARGS.
Gabriel Dos Reis - April 2, 2013, 2:34 p.m.
On Tue, Apr 2, 2013 at 8:34 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> I think this is my last obvious clean-up for now. I'm going to commit it
> when testing on x86_64-linux completes.

thanks.

-- Gaby

Patch

Index: friend.c
===================================================================
--- friend.c	(revision 197346)
+++ friend.c	(working copy)
@@ -485,8 +485,7 @@  do_friend (tree ctype, tree declarator, tree decl,
 	 to be a friend, so we do lookup here even if CTYPE is in
 	 the process of being defined.  */
       if (class_template_depth
-	  || COMPLETE_TYPE_P (ctype)
-	  || (CLASS_TYPE_P (ctype) && TYPE_BEING_DEFINED (ctype)))
+	  || COMPLETE_OR_OPEN_TYPE_P (ctype))
 	{
 	  if (DECL_TEMPLATE_INFO (decl))
 	    /* DECL is a template specialization.  No need to
Index: pt.c
===================================================================
--- pt.c	(revision 197347)
+++ pt.c	(working copy)
@@ -3058,10 +3058,7 @@  find_parameter_packs_r (tree *tp, int *walk_subtre
   bool parameter_pack_p = false;
 
   /* Handle type aliases/typedefs.  */
-  if (TYPE_P (t)
-      && TYPE_NAME (t)
-      && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL
-      && TYPE_DECL_ALIAS_P (TYPE_NAME (t)))
+  if (TYPE_ALIAS_P (t))
     {
       if (TYPE_TEMPLATE_INFO (t))
 	cp_walk_tree (&TYPE_TI_ARGS (t),
@@ -3146,7 +3143,7 @@  find_parameter_packs_r (tree *tp, int *walk_subtre
     case UNION_TYPE:
     case ENUMERAL_TYPE:
       if (TYPE_TEMPLATE_INFO (t))
-	cp_walk_tree (&TI_ARGS (TYPE_TEMPLATE_INFO (t)),
+	cp_walk_tree (&TYPE_TI_ARGS (t),
 		      &find_parameter_packs_r, ppd, ppd->visited);
 
       *walk_subtrees = 0;
@@ -7619,7 +7616,7 @@  for_each_template_parm_r (tree *tp, int *walk_subt
     case ENUMERAL_TYPE:
       if (!TYPE_TEMPLATE_INFO (t))
 	*walk_subtrees = 0;
-      else if (for_each_template_parm (TI_ARGS (TYPE_TEMPLATE_INFO (t)),
+      else if (for_each_template_parm (TYPE_TI_ARGS (t),
 				       fn, data, pfd->visited, 
 				       pfd->include_nondeduced_p))
 	return error_mark_node;