From ad2f7632f9c475a71481499715635ea3344b92d8 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Fri, 14 Jun 2002 14:34:26 +0000 Subject: 2002-06-14 Daniel Jacobowitz * gdbtypes.h (TYPE_FLAG_VARARGS): Update comment. (struct main_type): Remove arg_types member. Update comments for struct field. (TYPE_ARG_TYPES): Remove. (TYPE_FN_FIELD_ARGS): Update. (smash_to_method_type): Update prototype. * c-typeprint.c (cp_type_print_method_args): Take method type instead of argument list. Use new argument layout. Simplify. (c_type_print_args): Use new argument layout. Simplify. (c_type_print_base): Update call to cp_type_print_method_args. * dwarf2read.c (dwarf2_add_member_fn): Remove unneeded type argument; use die->type instead. Update call to smash_to_method_type. (read_structure_scope): Update call to dwarf2_add_member_fn. * gdbtypes.c (allocate_stub_method): Update comment. (smash_to_method_type): Take new NARGS and VARARGS arguments. Use new argument layout. (check_stub_method): Use new argument layout. Don't count void as an argument. (print_arg_types): Update comments. Use new argument layout. (recursive_dump_type): Don't print arg_types member. * hpread.c (hpread_read_struct_type): Use new argument layout. (fixup_class_method_type): Likewise. (hpread_type_lookup): Likewise. * stabsread.c (read_type): Update calls to read_args and smash_to_method_type. (read_args): Use new argument layout. Simplify. * valops.c (typecmp): Use new argument layout. Update parameters and comments. Simplify. (hand_function_call): Use new argument layout. (search_struct_method): Update call to typecmp. (find_overload_match): Use new argument layout. --- gdb/hpread.c | 42 +++++++----------------------------------- 1 file changed, 7 insertions(+), 35 deletions(-) (limited to 'gdb/hpread.c') diff --git a/gdb/hpread.c b/gdb/hpread.c index 98869a8..6443eac 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -3959,26 +3959,9 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* But mark it as NULL if the method was incompletely processed We'll fix this up later when the method is fully processed */ if (TYPE_INCOMPLETE (memtype)) - { - fn_p->field.fn_fields[ix].type = NULL; - } + fn_p->field.fn_fields[ix].type = NULL; else - { - fn_p->field.fn_fields[ix].type = memtype; - - /* The argument list */ - TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type).arg_types - = (struct type **) obstack_alloc (&objfile->type_obstack, - (sizeof (struct type *) - * (TYPE_NFIELDS (memtype) - + 1))); - for (i = 0; i < TYPE_NFIELDS (memtype); i++) - TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type) - .arg_types[i] = TYPE_FIELDS (memtype)[i].type; - /* void termination */ - TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type) - .arg_types[TYPE_NFIELDS (memtype)] = builtin_type_void; - } + fn_p->field.fn_fields[ix].type = memtype; /* For virtual functions, fill in the voffset field with the * virtual table offset. (This is just copied over from the @@ -4455,14 +4438,6 @@ fixup_class_method_type (struct type *class, struct type *method, { /* Set the method type */ TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j) = method; - /* The argument list */ - TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types - = (struct type **) obstack_alloc (&objfile->type_obstack, - sizeof (struct type *) * (TYPE_NFIELDS (method) + 1)); - for (k = 0; k < TYPE_NFIELDS (method); k++) - TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[k] = TYPE_FIELDS (method)[k].type; - /* void termination */ - TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[TYPE_NFIELDS (method)] = builtin_type_void; /* Break out of both loops -- only one method to fix up in a class */ goto finish; @@ -4916,21 +4891,18 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile) struct type *retvaltype; int nargs; int i; - struct type **args_type; class_type = hpread_type_lookup (dn_bufp->dptrmem.pointsto, objfile); functype = hpread_type_lookup (dn_bufp->dptrmem.memtype, objfile); retvaltype = TYPE_TARGET_TYPE (functype); nargs = TYPE_NFIELDS (functype); - args_type = (struct type **) xmalloc ((nargs + 1) * sizeof (struct type *)); - for (i = 0; i < nargs; i++) - { - args_type[i] = TYPE_FIELD_TYPE (functype, i); - } - args_type[nargs] = NULL; ptrmemtype = alloc_type (objfile); - smash_to_method_type (ptrmemtype, class_type, retvaltype, args_type); + + smash_to_method_type (ptrmemtype, class_type, retvaltype, + TYPE_FIELDS (functype), + TYPE_NFIELDS (functype), + 0); return make_pointer_type (ptrmemtype, NULL); } break; -- cgit v1.1