[lto] Stop using TREE_CHAIN on TYPE_ARG_TYPES in locate_copy.

Kazu Hirata kazu@codesourcery.com
Sun Jun 25 01:25:00 GMT 2006


Hi,

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

Kazu Hirata

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

	* method.c (locate_copy): Use num_parm_types,
	nth_parm_type, and num_artificial_parms_for.

Index: cp/method.c
===================================================================
--- cp/method.c	(revision 114740)
+++ cp/method.c	(working copy)
@@ -931,17 +931,19 @@ locate_copy (tree type, void *client_)
     {
       tree fn = OVL_CURRENT (fns);
       tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
+      int len = num_parm_types (parms);
       tree decls = DECL_ARGUMENTS (DECL_FUNCTION_TEMPLATE_P (fn)
 				   ? DECL_TEMPLATE_RESULT (fn) : fn);
       tree src_type;
       int excess;
       int quals;
+      int skip = 0;
 
-      parms = skip_artificial_parms_for (fn, parms);
-      if (!parms)
+      skip = num_artificial_parms_for (fn);
+      if (skip >= len)
 	continue;
       decls = skip_artificial_parms_for (fn, decls);
-      src_type = non_reference (TREE_VALUE (parms));
+      src_type = non_reference (nth_parm_type (parms, skip));
       if (!same_type_ignoring_top_level_qualifiers_p (src_type, type))
 	continue;
       if (!sufficient_parms_p (TREE_CHAIN (decls)))



More information about the Gcc-patches mailing list