This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto] Stop using TREE_CHAIN on TYPE_ARG_TYPES in build_op_delete_call.


Hi,

Attached is a patch to use num_parm_types and nth_parm_type instead of
TREE_CHAIN on TYPE_ARG_TYPES.

Tested on x86_64-pc-linux-gnu.  OK to apply to the LTO branch?

Kazu Hirata

2006-06-24  Kazu Hirata  <kazu@codesourcery.com>

	* call.c (build_op_delete_call): Use num_parm_types and
	nth_parm_type.

Index: cp/call.c
===================================================================
--- cp/call.c	(revision 114970)
+++ cp/call.c	(working copy)
@@ -3975,6 +3975,7 @@ build_op_delete_call (enum tree_code cod
   tree fn = NULL_TREE;
   tree fns, fnname, argtypes, args, type;
   int pass;
+  int skip = 0;
 
   if (addr == error_mark_node)
     return error_mark_node;
@@ -4009,7 +4010,8 @@ build_op_delete_call (enum tree_code cod
       /* Get the parameter types for the allocation function that is
 	 being called.  */
       gcc_assert (alloc_fn != NULL_TREE);
-      argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn)));
+      argtypes = TYPE_ARG_TYPES (TREE_TYPE (alloc_fn));
+      skip++;
       /* Also the second argument.  */
       args = TREE_CHAIN (TREE_OPERAND (placement, 1));
     }
@@ -4041,18 +4043,18 @@ build_op_delete_call (enum tree_code cod
 	  t = TYPE_ARG_TYPES (TREE_TYPE (OVL_CURRENT (fn)));
 	  if (!same_type_p (TREE_VALUE (t), ptr_type_node))
 	    continue;
-	  t = TREE_CHAIN (t);
 	  /* On the first pass, check the rest of the arguments.  */
 	  if (pass == 0)
 	    {
-	      if (compparms (argtypes, 0, t, 0))
+	      if (compparms (argtypes, skip, t, 1))
 		break;
 	    }
 	  /* On the second pass, the second argument must be
 	     "size_t".  */
 	  else if (pass == 1
-		   && same_type_p (TREE_VALUE (t), sizetype)
-		   && TREE_CHAIN (t) == void_list_node)
+		   && num_parm_types (t) == 3
+		   && same_type_p (nth_parm_type (t, 1), sizetype)
+		   && nth_parm_type (t, 2) == void_type_node)
 	    break;
 	}
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]