[lto] cp/*.c: Use nth_parm_type and copy_type_arg_types_skip.
Kazu Hirata
kazu@codesourcery.com
Mon Aug 14 14:56:00 GMT 2006
Hi,
Attached is a patch to use nth_parm_type and copy_type_arg_types_skip.
The conversion that each hunk does is independent of each other. I
hope folks won't mind me putting them all together here.
Tested on x86_64-pc-linux-gnu. Committed to the LTO branch as
obvious.
Kazu Hirata
2006-08-14 Kazu Hirata <kazu@codesourcery.com>
* decl.c (build_ptrmem_type, check_function_type): Use
nth_parm_type and copy_type_arg_types_skip.
* error.c (dump_type_suffix, dump_function_decl): Use
nth_parm_type.
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 116121)
+++ cp/decl.c (working copy)
@@ -6426,11 +6426,12 @@ build_ptrmem_type (tree class_type, tree
arg_types = TYPE_ARG_TYPES (member_type);
class_type = (cp_build_qualified_type
(class_type,
- cp_type_quals (TREE_TYPE (TREE_VALUE (arg_types)))));
+ cp_type_quals (TREE_TYPE (nth_parm_type (arg_types, 0)))));
+ arg_types = copy_type_arg_types_skip (arg_types, 1);
member_type
= build_method_type_directly (class_type,
TREE_TYPE (member_type),
- TREE_CHAIN (arg_types));
+ arg_types);
return build_ptrmemfunc_type (build_pointer_type (member_type));
}
else
@@ -10283,9 +10284,13 @@ check_function_type (tree decl, tree cur
/* Make it return void instead. */
if (TREE_CODE (fntype) == METHOD_TYPE)
- fntype = build_method_type_directly (TREE_TYPE (TREE_VALUE (args)),
- void_type_node,
- TREE_CHAIN (args));
+ {
+ tree first = nth_parm_type (args, 0);
+ tree remaining = copy_type_arg_types_skip (args, 1);
+ fntype = build_method_type_directly (TREE_TYPE (first),
+ void_type_node,
+ remaining);
+ }
else
fntype = build_function_type (void_type_node, args);
TREE_TYPE (decl)
Index: cp/error.c
===================================================================
--- cp/error.c (revision 116121)
+++ cp/error.c (working copy)
@@ -613,7 +613,7 @@ dump_type_suffix (tree t, int flags)
if (TREE_CODE (t) == METHOD_TYPE)
pp_cxx_cv_qualifier_seq
- (cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))));
+ (cxx_pp, TREE_TYPE (nth_parm_type (TYPE_ARG_TYPES (t), 0)));
else
pp_cxx_cv_qualifier_seq(cxx_pp, t);
dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags);
@@ -1053,7 +1053,7 @@ dump_function_decl (tree t, int flags)
{
pp_base (cxx_pp)->padding = pp_before;
pp_cxx_cv_qualifier_seq
- (cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))));
+ (cxx_pp, TREE_TYPE (nth_parm_type (TYPE_ARG_TYPES (fntype), 0)));
}
if (flags & TFF_EXCEPTION_SPECIFICATION)
More information about the Gcc-patches
mailing list