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 alloc_parm_types in implicitly_declare_fn.


Hi,

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

Kazu Hirata

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

	* method.c (implicitly_declare_fn): Use alloc_parm_types.

Index: cp/method.c
===================================================================
--- cp/method.c	(revision 116055)
+++ cp/method.c	(working copy)
@@ -977,7 +977,7 @@ static tree
 implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
 {
   tree fn;
-  tree parameter_types = void_list_node;
+  tree parameter_types;
   tree return_type;
   tree fn_type;
   tree raises = empty_except_spec;
@@ -1049,7 +1049,6 @@ implicitly_declare_fn (special_function_
       else
 	rhs_parm_type = type;
       rhs_parm_type = build_reference_type (rhs_parm_type);
-      parameter_types = tree_cons (NULL_TREE, rhs_parm_type, parameter_types);
       raises = synthesize_exception_spec (type, &locate_copy, &data);
       break;
     }
@@ -1058,6 +1057,17 @@ implicitly_declare_fn (special_function_
     }
 
   /* Create the function.  */
+  if (rhs_parm_type)
+    {
+      parameter_types = alloc_parm_types (2);
+      *(nth_parm_type_ptr (parameter_types, 0)) = rhs_parm_type;
+      *(nth_parm_type_ptr (parameter_types, 1)) = void_type_node;
+    }
+  else
+    {
+      parameter_types = alloc_parm_types (1);
+      *(nth_parm_type_ptr (parameter_types, 0)) = void_type_node;
+    }
   fn_type = build_method_type_directly (type, return_type, parameter_types);
   if (raises)
     fn_type = build_exception_variant (fn_type, raises);


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