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] Use num_parm_types and nth_parm_type in type_requires_array_cookie.


Hi,

Tested on x86_64-pc-linux-gnu.  Committed to the LTO branch as
obvious.

Kazu Hirata

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

	* class.c (type_requires_array_cookie): Use num_parm_types and
	nth_parm_type.

Index: cp/class.c
===================================================================
--- cp/class.c	(revision 114997)
+++ cp/class.c	(working copy)
@@ -3972,20 +3972,22 @@ type_requires_array_cookie (tree type)
   for (fns = BASELINK_FUNCTIONS (fns); fns; fns = OVL_NEXT (fns))
     {
       tree fn;
-      tree second_parm;
+      tree parm_types;
 
       /* Select the current function.  */
       fn = OVL_CURRENT (fns);
       /* See if this function is a one-argument delete function.  If
 	 it is, then it will be the usual deallocation function.  */
-      second_parm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn)));
-      if (second_parm == void_list_node)
+      parm_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
+      if (num_parm_types (parm_types) == 2
+	  && nth_parm_type (parm_types, 1) == void_type_node)
 	return false;
       /* Otherwise, if we have a two-argument function and the second
 	 argument is `size_t', it will be the usual deallocation
 	 function -- unless there is one-argument function, too.  */
-      if (TREE_CHAIN (second_parm) == void_list_node
-	  && same_type_p (TREE_VALUE (second_parm), sizetype))
+      if (num_parm_types (parm_types) == 3
+	  && nth_parm_type (parm_types, 2) == void_type_node
+	  && same_type_p (nth_parm_type (parm_types, 1), sizetype))
 	has_two_argument_delete_p = true;
     }
 


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