gdb: add field::type / field::set_type
Add the `type` and `set_type` methods on `struct field`, in order to remoremove the `FIELD_TYPE` macro. In this patch, the `FIELD_TYPE` macro is changed to use `field::type`, so all the call sites that are useused to set the field's type are changed to use `field::set_type`. The next patch will remove `FIELD_TYPE` completely. Note that because of the name clash between the existing field named `type` and the new method, I renamed the field `m_type`. It is not private per-se, because we can't make `struct field` a non-POD yet, but it should be considered private anyway (not accessed outside `struct field`). gdb/ChangeLog: * gdbtypes.h (struct field) <type, set_type>: New methods. Rename `type` field to... <m_type>: ... this. Change references throughout to use type or set_type methods. (FIELD_TYPE): Use field::type. Change call sites that modify the field's type to use field::set_type instead. Change-Id: Ie21f866e3b7f8a51ea49b722d07d272a724459a0
This commit is contained in:
parent
3d967001ec
commit
5d14b6e5d6
|
@ -1,3 +1,12 @@
|
||||||
|
2020-06-08 Simon Marchi <simon.marchi@efficios.com>
|
||||||
|
|
||||||
|
* gdbtypes.h (struct field) <type, set_type>: New methods.
|
||||||
|
Rename `type` field to...
|
||||||
|
<m_type>: ... this. Change references throughout to use type or
|
||||||
|
set_type methods.
|
||||||
|
(FIELD_TYPE): Use field::type. Change call sites that modify
|
||||||
|
the field's type to use field::set_type instead.
|
||||||
|
|
||||||
2020-06-08 Simon Marchi <simon.marchi@efficios.com>
|
2020-06-08 Simon Marchi <simon.marchi@efficios.com>
|
||||||
|
|
||||||
* gdbtypes.h (TYPE_INDEX_TYPE): Remove. Change all call sites
|
* gdbtypes.h (TYPE_INDEX_TYPE): Remove. Change all call sites
|
||||||
|
|
|
@ -1432,7 +1432,7 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
|
||||||
struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
|
struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
|
||||||
|
|
||||||
if (raw_type)
|
if (raw_type)
|
||||||
TYPE_FIELD_TYPE (index_desc_type, i) = raw_type;
|
index_desc_type->field (i).set_type (raw_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8088,7 +8088,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||||
record size. */
|
record size. */
|
||||||
ada_ensure_varsize_limit (field_type);
|
ada_ensure_varsize_limit (field_type);
|
||||||
|
|
||||||
TYPE_FIELD_TYPE (rtype, f) = field_type;
|
rtype->field (f).set_type (field_type);
|
||||||
TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
|
TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
|
||||||
/* The multiplication can potentially overflow. But because
|
/* The multiplication can potentially overflow. But because
|
||||||
the field length has been size-checked just above, and
|
the field length has been size-checked just above, and
|
||||||
|
@ -8111,7 +8111,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||||
structure, the typedef is the only clue which allows us
|
structure, the typedef is the only clue which allows us
|
||||||
to distinguish between the two options. Stripping it
|
to distinguish between the two options. Stripping it
|
||||||
would prevent us from printing this field appropriately. */
|
would prevent us from printing this field appropriately. */
|
||||||
TYPE_FIELD_TYPE (rtype, f) = TYPE_FIELD_TYPE (type, f);
|
rtype->field (f).set_type (TYPE_FIELD_TYPE (type, f));
|
||||||
TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
|
TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
|
||||||
if (TYPE_FIELD_BITSIZE (type, f) > 0)
|
if (TYPE_FIELD_BITSIZE (type, f) > 0)
|
||||||
fld_bit_len =
|
fld_bit_len =
|
||||||
|
@ -8173,7 +8173,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TYPE_FIELD_TYPE (rtype, variant_field) = branch_type;
|
rtype->field (variant_field).set_type (branch_type);
|
||||||
TYPE_FIELD_NAME (rtype, variant_field) = "S";
|
TYPE_FIELD_NAME (rtype, variant_field) = "S";
|
||||||
fld_bit_len =
|
fld_bit_len =
|
||||||
TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, variant_field)) *
|
TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, variant_field)) *
|
||||||
|
@ -8289,7 +8289,7 @@ template_to_static_fixed_type (struct type *type0)
|
||||||
TYPE_FIXED_INSTANCE (type) = 1;
|
TYPE_FIXED_INSTANCE (type) = 1;
|
||||||
TYPE_LENGTH (type) = 0;
|
TYPE_LENGTH (type) = 0;
|
||||||
}
|
}
|
||||||
TYPE_FIELD_TYPE (type, f) = new_type;
|
type->field (f).set_type (new_type);
|
||||||
TYPE_FIELD_NAME (type, f) = TYPE_FIELD_NAME (type0, f);
|
TYPE_FIELD_NAME (type, f) = TYPE_FIELD_NAME (type0, f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8358,7 +8358,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TYPE_FIELD_TYPE (rtype, variant_field) = branch_type;
|
rtype->field (variant_field).set_type (branch_type);
|
||||||
TYPE_FIELD_NAME (rtype, variant_field) = "S";
|
TYPE_FIELD_NAME (rtype, variant_field) = "S";
|
||||||
TYPE_FIELD_BITSIZE (rtype, variant_field) = 0;
|
TYPE_FIELD_BITSIZE (rtype, variant_field) = 0;
|
||||||
TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type);
|
TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type);
|
||||||
|
|
|
@ -286,7 +286,7 @@ buildsym_compunit::finish_block_internal
|
||||||
|
|
||||||
if (SYMBOL_IS_ARGUMENT (sym))
|
if (SYMBOL_IS_ARGUMENT (sym))
|
||||||
{
|
{
|
||||||
TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);
|
ftype->field (iparams).set_type (SYMBOL_TYPE (sym));
|
||||||
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
|
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
|
||||||
iparams++;
|
iparams++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,7 +302,7 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
|
||||||
if (FIELD_ARTIFICIAL (arg))
|
if (FIELD_ARTIFICIAL (arg))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
c_print_type (arg.type, "", stream, 0, 0, flags);
|
c_print_type (arg.type (), "", stream, 0, 0, flags);
|
||||||
|
|
||||||
if (i == nargs && varargs)
|
if (i == nargs && varargs)
|
||||||
fprintf_filtered (stream, ", ...");
|
fprintf_filtered (stream, ", ...");
|
||||||
|
@ -327,8 +327,8 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
|
||||||
struct type *domain;
|
struct type *domain;
|
||||||
|
|
||||||
gdb_assert (nargs > 0);
|
gdb_assert (nargs > 0);
|
||||||
gdb_assert (args[0].type->code () == TYPE_CODE_PTR);
|
gdb_assert (args[0].type ()->code () == TYPE_CODE_PTR);
|
||||||
domain = TYPE_TARGET_TYPE (args[0].type);
|
domain = TYPE_TARGET_TYPE (args[0].type ());
|
||||||
|
|
||||||
if (TYPE_CONST (domain))
|
if (TYPE_CONST (domain))
|
||||||
fprintf_filtered (stream, " const");
|
fprintf_filtered (stream, " const");
|
||||||
|
|
|
@ -2008,8 +2008,8 @@ coff_read_struct_type (int index, int length, int lastsym,
|
||||||
|
|
||||||
/* Save the data. */
|
/* Save the data. */
|
||||||
list->field.name = obstack_strdup (&objfile->objfile_obstack, name);
|
list->field.name = obstack_strdup (&objfile->objfile_obstack, name);
|
||||||
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
|
list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
|
||||||
&sub_aux, objfile);
|
objfile));
|
||||||
SET_FIELD_BITPOS (list->field, 8 * ms->c_value);
|
SET_FIELD_BITPOS (list->field, 8 * ms->c_value);
|
||||||
FIELD_BITSIZE (list->field) = 0;
|
FIELD_BITSIZE (list->field) = 0;
|
||||||
nfields++;
|
nfields++;
|
||||||
|
@ -2024,8 +2024,8 @@ coff_read_struct_type (int index, int length, int lastsym,
|
||||||
|
|
||||||
/* Save the data. */
|
/* Save the data. */
|
||||||
list->field.name = obstack_strdup (&objfile->objfile_obstack, name);
|
list->field.name = obstack_strdup (&objfile->objfile_obstack, name);
|
||||||
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
|
list->field.set_type (decode_type (ms, ms->c_type, &sub_aux,
|
||||||
&sub_aux, objfile);
|
objfile));
|
||||||
SET_FIELD_BITPOS (list->field, ms->c_value);
|
SET_FIELD_BITPOS (list->field, ms->c_value);
|
||||||
FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
|
FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
|
||||||
nfields++;
|
nfields++;
|
||||||
|
|
|
@ -379,7 +379,7 @@ ctf_add_member_cb (const char *name,
|
||||||
if (kind == CTF_K_STRUCT || kind == CTF_K_UNION)
|
if (kind == CTF_K_STRUCT || kind == CTF_K_UNION)
|
||||||
process_struct_members (ccp, tid, t);
|
process_struct_members (ccp, tid, t);
|
||||||
|
|
||||||
FIELD_TYPE (*fp) = t;
|
fp->set_type (t);
|
||||||
SET_FIELD_BITPOS (*fp, offset / TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*fp, offset / TARGET_CHAR_BIT);
|
||||||
FIELD_BITSIZE (*fp) = get_bitsize (ccp->fp, tid, kind);
|
FIELD_BITSIZE (*fp) = get_bitsize (ccp->fp, tid, kind);
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
|
||||||
|
|
||||||
fp = &new_field.field;
|
fp = &new_field.field;
|
||||||
FIELD_NAME (*fp) = name;
|
FIELD_NAME (*fp) = name;
|
||||||
FIELD_TYPE (*fp) = NULL;
|
fp->set_type (NULL);
|
||||||
SET_FIELD_ENUMVAL (*fp, enum_value);
|
SET_FIELD_ENUMVAL (*fp, enum_value);
|
||||||
FIELD_BITSIZE (*fp) = 0;
|
FIELD_BITSIZE (*fp) = 0;
|
||||||
|
|
||||||
|
@ -1152,9 +1152,9 @@ add_stt_func (struct ctf_context *ccp, unsigned long idx)
|
||||||
{
|
{
|
||||||
atyp = get_tid_type (ccp->of, argv[iparam]);
|
atyp = get_tid_type (ccp->of, argv[iparam]);
|
||||||
if (atyp)
|
if (atyp)
|
||||||
TYPE_FIELD_TYPE (ftype, iparam) = atyp;
|
ftype->field (iparam).set_type (atyp);
|
||||||
else
|
else
|
||||||
TYPE_FIELD_TYPE (ftype, iparam) = void_type;
|
ftype->field (iparam).set_type (void_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
sym = new_symbol (ccp, ftype, tid);
|
sym = new_symbol (ccp, ftype, tid);
|
||||||
|
|
|
@ -9504,7 +9504,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
|
||||||
((struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field)));
|
((struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field)));
|
||||||
|
|
||||||
/* Put the discriminant at index 0. */
|
/* Put the discriminant at index 0. */
|
||||||
TYPE_FIELD_TYPE (type, 0) = field_type;
|
type->field (0).set_type (field_type);
|
||||||
TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
|
TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
|
||||||
TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
|
TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
|
||||||
SET_FIELD_BITPOS (type->field (0), bit_offset);
|
SET_FIELD_BITPOS (type->field (0), bit_offset);
|
||||||
|
@ -9523,7 +9523,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
|
||||||
name);
|
name);
|
||||||
struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
|
struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
|
||||||
dataless_name);
|
dataless_name);
|
||||||
TYPE_FIELD_TYPE (type, 2) = dataless_type;
|
type->field (2).set_type (dataless_type);
|
||||||
/* NAME points into the original discriminant name, which
|
/* NAME points into the original discriminant name, which
|
||||||
already has the correct lifetime. */
|
already has the correct lifetime. */
|
||||||
TYPE_FIELD_NAME (type, 2) = name;
|
TYPE_FIELD_NAME (type, 2) = name;
|
||||||
|
@ -14539,7 +14539,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
|
||||||
/* Data member other than a C++ static data member. */
|
/* Data member other than a C++ static data member. */
|
||||||
|
|
||||||
/* Get type of field. */
|
/* Get type of field. */
|
||||||
fp->type = die_type (die, cu);
|
fp->set_type (die_type (die, cu));
|
||||||
|
|
||||||
SET_FIELD_BITPOS (*fp, 0);
|
SET_FIELD_BITPOS (*fp, 0);
|
||||||
|
|
||||||
|
@ -14593,7 +14593,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
|
||||||
the bit field must be inferred from the type
|
the bit field must be inferred from the type
|
||||||
attribute of the data member containing the
|
attribute of the data member containing the
|
||||||
bit field. */
|
bit field. */
|
||||||
anonymous_size = TYPE_LENGTH (fp->type);
|
anonymous_size = TYPE_LENGTH (fp->type ());
|
||||||
}
|
}
|
||||||
SET_FIELD_BITPOS (*fp,
|
SET_FIELD_BITPOS (*fp,
|
||||||
(FIELD_BITPOS (*fp)
|
(FIELD_BITPOS (*fp)
|
||||||
|
@ -14659,7 +14659,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
|
||||||
/* The name is already allocated along with this objfile, so we don't
|
/* The name is already allocated along with this objfile, so we don't
|
||||||
need to duplicate it for the type. */
|
need to duplicate it for the type. */
|
||||||
SET_FIELD_PHYSNAME (*fp, physname ? physname : "");
|
SET_FIELD_PHYSNAME (*fp, physname ? physname : "");
|
||||||
FIELD_TYPE (*fp) = die_type (die, cu);
|
fp->set_type (die_type (die, cu));
|
||||||
FIELD_NAME (*fp) = fieldname;
|
FIELD_NAME (*fp) = fieldname;
|
||||||
}
|
}
|
||||||
else if (die->tag == DW_TAG_inheritance)
|
else if (die->tag == DW_TAG_inheritance)
|
||||||
|
@ -14667,8 +14667,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
|
||||||
/* C++ base class field. */
|
/* C++ base class field. */
|
||||||
handle_data_member_location (die, cu, fp);
|
handle_data_member_location (die, cu, fp);
|
||||||
FIELD_BITSIZE (*fp) = 0;
|
FIELD_BITSIZE (*fp) = 0;
|
||||||
FIELD_TYPE (*fp) = die_type (die, cu);
|
fp->set_type (die_type (die, cu));
|
||||||
FIELD_NAME (*fp) = fp->type->name ();
|
FIELD_NAME (*fp) = fp->type ()->name ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gdb_assert_not_reached ("missing case in dwarf2_add_field");
|
gdb_assert_not_reached ("missing case in dwarf2_add_field");
|
||||||
|
@ -17227,7 +17227,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
/* TYPE_FIELD_TYPE must never be NULL. Pre-fill the array to ensure it
|
/* TYPE_FIELD_TYPE must never be NULL. Pre-fill the array to ensure it
|
||||||
even if we error out during the parameters reading below. */
|
even if we error out during the parameters reading below. */
|
||||||
for (iparams = 0; iparams < nparams; iparams++)
|
for (iparams = 0; iparams < nparams; iparams++)
|
||||||
TYPE_FIELD_TYPE (ftype, iparams) = void_type;
|
ftype->field (iparams).set_type (void_type);
|
||||||
|
|
||||||
iparams = 0;
|
iparams = 0;
|
||||||
child_die = die->child;
|
child_die = die->child;
|
||||||
|
@ -17284,7 +17284,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
arg_type, 0);
|
arg_type, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPE_FIELD_TYPE (ftype, iparams) = arg_type;
|
ftype->field (iparams).set_type (arg_type);
|
||||||
iparams++;
|
iparams++;
|
||||||
}
|
}
|
||||||
child_die = child_die->sibling;
|
child_die = child_die->sibling;
|
||||||
|
|
|
@ -686,7 +686,7 @@ fake_method::fake_method (type_instance_flags flags,
|
||||||
((struct field *) xzalloc (sizeof (struct field) * num_types));
|
((struct field *) xzalloc (sizeof (struct field) * num_types));
|
||||||
|
|
||||||
while (num_types-- > 0)
|
while (num_types-- > 0)
|
||||||
TYPE_FIELD_TYPE (type, num_types) = param_types[num_types];
|
type->field (num_types).set_type (param_types[num_types]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fake_method::~fake_method ()
|
fake_method::~fake_method ()
|
||||||
|
|
|
@ -566,7 +566,7 @@ lookup_function_type_with_arguments (struct type *type,
|
||||||
fn->set_fields
|
fn->set_fields
|
||||||
((struct field *) TYPE_ZALLOC (fn, nparams * sizeof (struct field)));
|
((struct field *) TYPE_ZALLOC (fn, nparams * sizeof (struct field)));
|
||||||
for (i = 0; i < nparams; ++i)
|
for (i = 0; i < nparams; ++i)
|
||||||
TYPE_FIELD_TYPE (fn, i) = param_types[i];
|
fn->field (i).set_type (param_types[i]);
|
||||||
|
|
||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
@ -1405,7 +1405,7 @@ create_set_type (struct type *result_type, struct type *domain_type)
|
||||||
if (low_bound >= 0)
|
if (low_bound >= 0)
|
||||||
TYPE_UNSIGNED (result_type) = 1;
|
TYPE_UNSIGNED (result_type) = 1;
|
||||||
}
|
}
|
||||||
TYPE_FIELD_TYPE (result_type, 0) = domain_type;
|
result_type->field (0).set_type (domain_type);
|
||||||
|
|
||||||
return result_type;
|
return result_type;
|
||||||
}
|
}
|
||||||
|
@ -2263,7 +2263,7 @@ resolve_dynamic_union (struct type *type,
|
||||||
|
|
||||||
t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
|
t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
|
||||||
addr_stack, 0);
|
addr_stack, 0);
|
||||||
TYPE_FIELD_TYPE (resolved_type, i) = t;
|
resolved_type->field (i).set_type (t);
|
||||||
if (TYPE_LENGTH (t) > max_len)
|
if (TYPE_LENGTH (t) > max_len)
|
||||||
max_len = TYPE_LENGTH (t);
|
max_len = TYPE_LENGTH (t);
|
||||||
}
|
}
|
||||||
|
@ -2511,9 +2511,9 @@ resolve_dynamic_struct (struct type *type,
|
||||||
+ (TYPE_FIELD_BITPOS (resolved_type, i) / TARGET_CHAR_BIT));
|
+ (TYPE_FIELD_BITPOS (resolved_type, i) / TARGET_CHAR_BIT));
|
||||||
pinfo.next = addr_stack;
|
pinfo.next = addr_stack;
|
||||||
|
|
||||||
TYPE_FIELD_TYPE (resolved_type, i)
|
resolved_type->field (i).set_type
|
||||||
= resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
|
(resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
|
||||||
&pinfo, 0);
|
&pinfo, 0));
|
||||||
gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
|
gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
|
||||||
== FIELD_LOC_KIND_BITPOS);
|
== FIELD_LOC_KIND_BITPOS);
|
||||||
|
|
||||||
|
@ -3011,7 +3011,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
|
||||||
argcount = 0;
|
argcount = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
argtypes[0].type = lookup_pointer_type (type);
|
argtypes[0].set_type (lookup_pointer_type (type));
|
||||||
argcount = 1;
|
argcount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3027,8 +3027,8 @@ check_stub_method (struct type *type, int method_id, int signature_id)
|
||||||
if (strncmp (argtypetext, "...", p - argtypetext) != 0
|
if (strncmp (argtypetext, "...", p - argtypetext) != 0
|
||||||
&& strncmp (argtypetext, "void", p - argtypetext) != 0)
|
&& strncmp (argtypetext, "void", p - argtypetext) != 0)
|
||||||
{
|
{
|
||||||
argtypes[argcount].type =
|
argtypes[argcount].set_type
|
||||||
safe_parse_type (gdbarch, argtypetext, p - argtypetext);
|
(safe_parse_type (gdbarch, argtypetext, p - argtypetext));
|
||||||
argcount += 1;
|
argcount += 1;
|
||||||
}
|
}
|
||||||
argtypetext = p + 1;
|
argtypetext = p + 1;
|
||||||
|
@ -4712,7 +4712,7 @@ print_args (struct field *args, int nargs, int spaces)
|
||||||
{
|
{
|
||||||
printfi_filtered (spaces, "[%d] name '%s'\n", i,
|
printfi_filtered (spaces, "[%d] name '%s'\n", i,
|
||||||
args[i].name != NULL ? args[i].name : "<NULL>");
|
args[i].name != NULL ? args[i].name : "<NULL>");
|
||||||
recursive_dump_type (args[i].type, spaces + 2);
|
recursive_dump_type (args[i].type (), spaces + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5321,9 +5321,9 @@ copy_type_recursive (struct objfile *objfile,
|
||||||
TYPE_FIELD_ARTIFICIAL (type, i);
|
TYPE_FIELD_ARTIFICIAL (type, i);
|
||||||
TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
|
TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
|
||||||
if (TYPE_FIELD_TYPE (type, i))
|
if (TYPE_FIELD_TYPE (type, i))
|
||||||
TYPE_FIELD_TYPE (new_type, i)
|
new_type->field (i).set_type
|
||||||
= copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
|
(copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
|
||||||
copied_types);
|
copied_types));
|
||||||
if (TYPE_FIELD_NAME (type, i))
|
if (TYPE_FIELD_NAME (type, i))
|
||||||
TYPE_FIELD_NAME (new_type, i) =
|
TYPE_FIELD_NAME (new_type, i) =
|
||||||
xstrdup (TYPE_FIELD_NAME (type, i));
|
xstrdup (TYPE_FIELD_NAME (type, i));
|
||||||
|
@ -5596,7 +5596,7 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
|
||||||
gdb_assert (name != NULL);
|
gdb_assert (name != NULL);
|
||||||
|
|
||||||
TYPE_FIELD_NAME (type, field_nr) = xstrdup (name);
|
TYPE_FIELD_NAME (type, field_nr) = xstrdup (name);
|
||||||
TYPE_FIELD_TYPE (type, field_nr) = field_type;
|
type->field (field_nr).set_type (field_type);
|
||||||
SET_FIELD_BITPOS (type->field (field_nr), start_bitpos);
|
SET_FIELD_BITPOS (type->field (field_nr), start_bitpos);
|
||||||
TYPE_FIELD_BITSIZE (type, field_nr) = nr_bits;
|
TYPE_FIELD_BITSIZE (type, field_nr) = nr_bits;
|
||||||
type->set_num_fields (type->num_fields () + 1);
|
type->set_num_fields (type->num_fields () + 1);
|
||||||
|
@ -5647,7 +5647,7 @@ append_composite_type_field_raw (struct type *t, const char *name,
|
||||||
t->num_fields ()));
|
t->num_fields ()));
|
||||||
f = &t->field (t->num_fields () - 1);
|
f = &t->field (t->num_fields () - 1);
|
||||||
memset (f, 0, sizeof f[0]);
|
memset (f, 0, sizeof f[0]);
|
||||||
FIELD_TYPE (f[0]) = field;
|
f[0].set_type (field);
|
||||||
FIELD_NAME (f[0]) = name;
|
FIELD_NAME (f[0]) = name;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -635,6 +635,16 @@ union field_location
|
||||||
|
|
||||||
struct field
|
struct field
|
||||||
{
|
{
|
||||||
|
struct type *type () const
|
||||||
|
{
|
||||||
|
return this->m_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_type (struct type *type)
|
||||||
|
{
|
||||||
|
this->m_type = type;
|
||||||
|
}
|
||||||
|
|
||||||
union field_location loc;
|
union field_location loc;
|
||||||
|
|
||||||
/* * For a function or member type, this is 1 if the argument is
|
/* * For a function or member type, this is 1 if the argument is
|
||||||
|
@ -660,7 +670,7 @@ struct field
|
||||||
- In a function or member type, type of this argument.
|
- In a function or member type, type of this argument.
|
||||||
- In an array type, the domain-type of the array. */
|
- In an array type, the domain-type of the array. */
|
||||||
|
|
||||||
struct type *type;
|
struct type *m_type;
|
||||||
|
|
||||||
/* * Name of field, value or argument.
|
/* * Name of field, value or argument.
|
||||||
NULL for range bounds, array domains, and member function
|
NULL for range bounds, array domains, and member function
|
||||||
|
@ -935,12 +945,12 @@ struct type
|
||||||
|
|
||||||
type *index_type () const
|
type *index_type () const
|
||||||
{
|
{
|
||||||
return this->field (0).type;
|
return this->field (0).type ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_index_type (type *index_type)
|
void set_index_type (type *index_type)
|
||||||
{
|
{
|
||||||
this->field (0).type = index_type;
|
this->field (0).set_type (index_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* * Return the dynamic property of the requested KIND from this type's
|
/* * Return the dynamic property of the requested KIND from this type's
|
||||||
|
@ -1600,7 +1610,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||||
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
|
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
|
||||||
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
|
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
|
||||||
|
|
||||||
#define FIELD_TYPE(thisfld) ((thisfld).type)
|
#define FIELD_TYPE(thisfld) ((thisfld).type ())
|
||||||
#define FIELD_NAME(thisfld) ((thisfld).name)
|
#define FIELD_NAME(thisfld) ((thisfld).name)
|
||||||
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
|
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
|
||||||
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
|
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
|
||||||
|
|
|
@ -135,28 +135,28 @@ build_gdb_vtable_type (struct gdbarch *arch)
|
||||||
|
|
||||||
/* ptrdiff_t vcall_and_vbase_offsets[0]; */
|
/* ptrdiff_t vcall_and_vbase_offsets[0]; */
|
||||||
FIELD_NAME (*field) = "vcall_and_vbase_offsets";
|
FIELD_NAME (*field) = "vcall_and_vbase_offsets";
|
||||||
FIELD_TYPE (*field) = lookup_array_range_type (ptrdiff_type, 0, -1);
|
field->set_type (lookup_array_range_type (ptrdiff_type, 0, -1));
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
/* ptrdiff_t offset_to_top; */
|
/* ptrdiff_t offset_to_top; */
|
||||||
FIELD_NAME (*field) = "offset_to_top";
|
FIELD_NAME (*field) = "offset_to_top";
|
||||||
FIELD_TYPE (*field) = ptrdiff_type;
|
field->set_type (ptrdiff_type);
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
/* void *type_info; */
|
/* void *type_info; */
|
||||||
FIELD_NAME (*field) = "type_info";
|
FIELD_NAME (*field) = "type_info";
|
||||||
FIELD_TYPE (*field) = void_ptr_type;
|
field->set_type (void_ptr_type);
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
/* void (*virtual_functions[0]) (); */
|
/* void (*virtual_functions[0]) (); */
|
||||||
FIELD_NAME (*field) = "virtual_functions";
|
FIELD_NAME (*field) = "virtual_functions";
|
||||||
FIELD_TYPE (*field) = lookup_array_range_type (ptr_to_void_fn_type, 0, -1);
|
field->set_type (lookup_array_range_type (ptr_to_void_fn_type, 0, -1));
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
||||||
field++;
|
field++;
|
||||||
|
@ -1039,14 +1039,14 @@ build_std_type_info_type (struct gdbarch *arch)
|
||||||
|
|
||||||
/* The vtable. */
|
/* The vtable. */
|
||||||
FIELD_NAME (*field) = "_vptr.type_info";
|
FIELD_NAME (*field) = "_vptr.type_info";
|
||||||
FIELD_TYPE (*field) = void_ptr_type;
|
field->set_type (void_ptr_type);
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
||||||
field++;
|
field++;
|
||||||
|
|
||||||
/* The name. */
|
/* The name. */
|
||||||
FIELD_NAME (*field) = "__name";
|
FIELD_NAME (*field) = "__name";
|
||||||
FIELD_TYPE (*field) = char_ptr_type;
|
field->set_type (char_ptr_type);
|
||||||
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
SET_FIELD_BITPOS (*field, offset * TARGET_CHAR_BIT);
|
||||||
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
offset += TYPE_LENGTH (FIELD_TYPE (*field));
|
||||||
field++;
|
field++;
|
||||||
|
|
|
@ -607,7 +607,7 @@ iq2000_pass_8bytetype_by_address (struct type *type)
|
||||||
if (type->num_fields () != 1)
|
if (type->num_fields () != 1)
|
||||||
return 1;
|
return 1;
|
||||||
/* Get field type. */
|
/* Get field type. */
|
||||||
ftype = type->field (0).type;
|
ftype = type->field (0).type ();
|
||||||
/* The field type must have size 8, otherwise pass by address. */
|
/* The field type must have size 8, otherwise pass by address. */
|
||||||
if (TYPE_LENGTH (ftype) != 8)
|
if (TYPE_LENGTH (ftype) != 8)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -1051,7 +1051,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SET_FIELD_ENUMVAL (*f, tsym.value);
|
SET_FIELD_ENUMVAL (*f, tsym.value);
|
||||||
FIELD_TYPE (*f) = t;
|
f->set_type (t);
|
||||||
FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss;
|
FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss;
|
||||||
FIELD_BITSIZE (*f) = 0;
|
FIELD_BITSIZE (*f) = 0;
|
||||||
|
|
||||||
|
@ -1198,7 +1198,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||||
|
|
||||||
if (SYMBOL_IS_ARGUMENT (sym))
|
if (SYMBOL_IS_ARGUMENT (sym))
|
||||||
{
|
{
|
||||||
TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);
|
ftype->field (iparams).set_type (SYMBOL_TYPE (sym));
|
||||||
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
|
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
|
||||||
iparams++;
|
iparams++;
|
||||||
}
|
}
|
||||||
|
@ -1238,8 +1238,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||||
FIELD_NAME (*f) = name;
|
FIELD_NAME (*f) = name;
|
||||||
SET_FIELD_BITPOS (*f, sh->value);
|
SET_FIELD_BITPOS (*f, sh->value);
|
||||||
bitsize = 0;
|
bitsize = 0;
|
||||||
FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index,
|
f->set_type (parse_type (cur_fd, ax, sh->index, &bitsize, bigend,
|
||||||
&bitsize, bigend, name);
|
name));
|
||||||
FIELD_BITSIZE (*f) = bitsize;
|
FIELD_BITSIZE (*f) = bitsize;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -988,7 +988,7 @@ rust_composite_type (struct type *original,
|
||||||
bitpos += TYPE_LENGTH (type1) * TARGET_CHAR_BIT;
|
bitpos += TYPE_LENGTH (type1) * TARGET_CHAR_BIT;
|
||||||
|
|
||||||
FIELD_NAME (*field) = field1;
|
FIELD_NAME (*field) = field1;
|
||||||
FIELD_TYPE (*field) = type1;
|
field->set_type (type1);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (field2 != NULL)
|
if (field2 != NULL)
|
||||||
|
@ -1008,7 +1008,7 @@ rust_composite_type (struct type *original,
|
||||||
SET_FIELD_BITPOS (*field, bitpos);
|
SET_FIELD_BITPOS (*field, bitpos);
|
||||||
|
|
||||||
FIELD_NAME (*field) = field2;
|
FIELD_NAME (*field) = field2;
|
||||||
FIELD_TYPE (*field) = type2;
|
field->set_type (type2);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1007,7 +1007,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
|
||||||
FIXME: Do we need a new builtin_promoted_int_arg ? */
|
FIXME: Do we need a new builtin_promoted_int_arg ? */
|
||||||
if (ptype->code () == TYPE_CODE_VOID)
|
if (ptype->code () == TYPE_CODE_VOID)
|
||||||
ptype = objfile_type (objfile)->builtin_int;
|
ptype = objfile_type (objfile)->builtin_int;
|
||||||
TYPE_FIELD_TYPE (ftype, nparams) = ptype;
|
ftype->field (nparams).set_type (ptype);
|
||||||
TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
|
TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
|
||||||
}
|
}
|
||||||
ftype->set_num_fields (nparams);
|
ftype->set_num_fields (nparams);
|
||||||
|
@ -1849,7 +1849,7 @@ again:
|
||||||
when we read it, so the list is reversed. Build the
|
when we read it, so the list is reversed. Build the
|
||||||
fields array right-to-left. */
|
fields array right-to-left. */
|
||||||
for (t = arg_types, i = num_args - 1; t; t = t->next, i--)
|
for (t = arg_types, i = num_args - 1; t; t = t->next, i--)
|
||||||
TYPE_FIELD_TYPE (func_type, i) = t->type;
|
func_type->field (i).set_type (t->type);
|
||||||
}
|
}
|
||||||
func_type->set_num_fields (num_args);
|
func_type->set_num_fields (num_args);
|
||||||
TYPE_PROTOTYPED (func_type) = 1;
|
TYPE_PROTOTYPED (func_type) = 1;
|
||||||
|
@ -2788,7 +2788,7 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
|
||||||
invalid_cpp_abbrev_complaint (*pp);
|
invalid_cpp_abbrev_complaint (*pp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
fip->list->field.type = read_type (pp, objfile);
|
fip->list->field.set_type (read_type (pp, objfile));
|
||||||
if (**pp == ',')
|
if (**pp == ',')
|
||||||
(*pp)++; /* Skip the comma. */
|
(*pp)++; /* Skip the comma. */
|
||||||
else
|
else
|
||||||
|
@ -2840,7 +2840,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
|
||||||
fip->list->visibility = VISIBILITY_PUBLIC;
|
fip->list->visibility = VISIBILITY_PUBLIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
fip->list->field.type = read_type (pp, objfile);
|
fip->list->field.set_type (read_type (pp, objfile));
|
||||||
if (**pp == ':')
|
if (**pp == ':')
|
||||||
{
|
{
|
||||||
p = ++(*pp);
|
p = ++(*pp);
|
||||||
|
@ -3161,8 +3161,8 @@ read_baseclasses (struct stab_field_info *fip, const char **pp,
|
||||||
base class. Read it, and remember it's type name as this
|
base class. Read it, and remember it's type name as this
|
||||||
field's name. */
|
field's name. */
|
||||||
|
|
||||||
newobj->field.type = read_type (pp, objfile);
|
newobj->field.set_type (read_type (pp, objfile));
|
||||||
newobj->field.name = newobj->field.type->name ();
|
newobj->field.name = newobj->field.type ()->name ();
|
||||||
|
|
||||||
/* Skip trailing ';' and bump count of number of fields seen. */
|
/* Skip trailing ';' and bump count of number of fields seen. */
|
||||||
if (**pp == ';')
|
if (**pp == ';')
|
||||||
|
@ -4242,7 +4242,7 @@ read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
|
||||||
|
|
||||||
rval = XCNEWVEC (struct field, n);
|
rval = XCNEWVEC (struct field, n);
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
rval[i].type = types[i];
|
rval[i].set_type (types[i]);
|
||||||
*nargsp = n;
|
*nargsp = n;
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1707,7 +1707,7 @@ typecmp (int staticp, int varargs, int nargs,
|
||||||
t2 ++;
|
t2 ++;
|
||||||
|
|
||||||
for (i = 0;
|
for (i = 0;
|
||||||
(i < nargs) && t1[i].type->code () != TYPE_CODE_VOID;
|
(i < nargs) && t1[i].type ()->code () != TYPE_CODE_VOID;
|
||||||
i++)
|
i++)
|
||||||
{
|
{
|
||||||
struct type *tt1, *tt2;
|
struct type *tt1, *tt2;
|
||||||
|
@ -1715,7 +1715,7 @@ typecmp (int staticp, int varargs, int nargs,
|
||||||
if (!t2[i])
|
if (!t2[i])
|
||||||
return i + 1;
|
return i + 1;
|
||||||
|
|
||||||
tt1 = check_typedef (t1[i].type);
|
tt1 = check_typedef (t1[i].type ());
|
||||||
tt2 = check_typedef (value_type (t2[i]));
|
tt2 = check_typedef (value_type (t2[i]));
|
||||||
|
|
||||||
if (TYPE_IS_REFERENCE (tt1)
|
if (TYPE_IS_REFERENCE (tt1)
|
||||||
|
@ -1754,7 +1754,7 @@ typecmp (int staticp, int varargs, int nargs,
|
||||||
/* We should be doing much hairier argument matching (see
|
/* We should be doing much hairier argument matching (see
|
||||||
section 13.2 of the ARM), but as a quick kludge, just check
|
section 13.2 of the ARM), but as a quick kludge, just check
|
||||||
for the same type code. */
|
for the same type code. */
|
||||||
if (t1[i].type->code () != value_type (t2[i])->code ())
|
if (t1[i].type ()->code () != value_type (t2[i])->code ())
|
||||||
return i + 1;
|
return i + 1;
|
||||||
}
|
}
|
||||||
if (varargs || t2[i] == NULL)
|
if (varargs || t2[i] == NULL)
|
||||||
|
@ -2967,7 +2967,7 @@ find_oload_champ (gdb::array_view<value *> args,
|
||||||
for (jj = 0; jj < nparms; jj++)
|
for (jj = 0; jj < nparms; jj++)
|
||||||
{
|
{
|
||||||
type *t = (methods != NULL
|
type *t = (methods != NULL
|
||||||
? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type)
|
? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ())
|
||||||
: TYPE_FIELD_TYPE (SYMBOL_TYPE (functions[ix]),
|
: TYPE_FIELD_TYPE (SYMBOL_TYPE (functions[ix]),
|
||||||
jj));
|
jj));
|
||||||
parm_types.push_back (t);
|
parm_types.push_back (t);
|
||||||
|
|
Loading…
Reference in New Issue