[lto] Use num_artificial_parms_for and nth_parm_type in pp_cxx_parameter_declaration_clause.

Kazu Hirata kazu@codesourcery.com
Mon Jul 10 16:43:00 GMT 2006


Hi,

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

Kazu Hirata

2006-07-10  Kazu Hirata  <kazu@codesourcery.com>

	* cxx-pretty-print.c (pp_cxx_parameter_declaration_clause):
	Use num_artificial_parms_for and nth_parm_type in
	pp_cxx_parameter_declaration_clause.

Index: cp/cxx-pretty-print.c
===================================================================
--- cp/cxx-pretty-print.c	(revision 115303)
+++ cp/cxx-pretty-print.c	(working copy)
@@ -1216,23 +1216,27 @@ static void
 pp_cxx_parameter_declaration_clause (cxx_pretty_printer *pp, tree t)
 {
   tree args = TYPE_P (t) ? NULL : FUNCTION_FIRST_USER_PARM (t);
-  tree types =
-    TYPE_P (t) ? TYPE_ARG_TYPES (t) : FUNCTION_FIRST_USER_PARMTYPE (t);
+  tree types = (TYPE_P (t)
+		? TYPE_ARG_TYPES (t)
+		: TYPE_ARG_TYPES (TREE_TYPE (t)));
+  int skip = TYPE_P (t) ? 0 : num_artificial_parms_for (t);
   const bool abstract = args == NULL
     || pp_c_base (pp)->flags & pp_c_flag_abstract;
-  bool first = true;
+  int i;
 
   /* Skip artificial parameter for nonstatic member functions.  */
   if (TREE_CODE (t) == METHOD_TYPE)
-    types = TREE_CHAIN (types);
+    skip++;
 
   pp_cxx_left_paren (pp);
-  for (; args; args = TREE_CHAIN (args), types = TREE_CHAIN (types))
+  for (i = skip; args; args = TREE_CHAIN (args), i++)
     {
-      if (!first)
+      if (i != skip)
 	pp_cxx_separate_with (pp, ',');
-      first = false;
-      pp_cxx_parameter_declaration (pp, abstract ? TREE_VALUE (types) : args);
+      pp_cxx_parameter_declaration (pp,
+				    (abstract
+				     ? nth_parm_type (types, i)
+				     : args));
       if (!abstract && pp_c_base (pp)->flags & pp_cxx_flag_default_argument)
 	{
 	  pp_cxx_whitespace (pp);



More information about the Gcc-patches mailing list