gdb: remove TYPE_FIELD_TYPE macro

Remove the `TYPE_FIELD_TYPE` macro, changing all the call sites to use
`type::field` and `field::type` directly.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_FIELD_TYPE): Remove.  Change all call sites
	to use type::field and field::type instead.

Change-Id: Ifda6226a25c811cfd334a756a9fbc5c0afdddff3
This commit is contained in:
Simon Marchi 2020-06-08 15:26:20 -04:00
parent b6cdac4b80
commit 940da03e32
62 changed files with 287 additions and 292 deletions

View File

@ -1,3 +1,8 @@
2020-06-08 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (TYPE_FIELD_TYPE): Remove. Change all call sites
to use type::field and field::type instead.
2020-06-08 Simon Marchi <simon.marchi@efficios.com> 2020-06-08 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (FIELD_TYPE): Remove. Change all call sites * gdbtypes.h (FIELD_TYPE): Remove. Change all call sites

View File

@ -1352,7 +1352,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
if (field_is_static (&type->field (i))) if (field_is_static (&type->field (i)))
continue; continue;
struct type *member = check_typedef (TYPE_FIELD_TYPE (type, i)); struct type *member = check_typedef (type->field (i).type ());
int sub_count = aapcs_is_vfp_call_or_return_candidate_1 int sub_count = aapcs_is_vfp_call_or_return_candidate_1
(member, fundamental_type); (member, fundamental_type);

View File

@ -1158,7 +1158,7 @@ get_symbol_field_type (struct symbol *sym, char *encoded_field_name)
fieldno = ada_get_field_index (type, field_name, 1); fieldno = ada_get_field_index (type, field_name, 1);
if (fieldno >= 0) if (fieldno >= 0)
return TYPE_FIELD_TYPE (type, fieldno); return type->field (fieldno).type ();
subfield_name = field_name; subfield_name = field_name;
while (*subfield_name != '\0' && *subfield_name != '.' while (*subfield_name != '\0' && *subfield_name != '.'
@ -1173,7 +1173,7 @@ get_symbol_field_type (struct symbol *sym, char *encoded_field_name)
if (fieldno < 0) if (fieldno < 0)
return NULL; return NULL;
type = TYPE_FIELD_TYPE (type, fieldno); type = type->field (fieldno).type ();
field_name = subfield_name; field_name = subfield_name;
} }

View File

@ -1420,8 +1420,8 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
If our INDEX_DESC_TYPE was generated using the older encoding, If our INDEX_DESC_TYPE was generated using the older encoding,
the field type should be a meaningless integer type whose name the field type should be a meaningless integer type whose name
is not equal to the field name. */ is not equal to the field name. */
if (TYPE_FIELD_TYPE (index_desc_type, 0)->name () != NULL if (index_desc_type->field (0).type ()->name () != NULL
&& strcmp (TYPE_FIELD_TYPE (index_desc_type, 0)->name (), && strcmp (index_desc_type->field (0).type ()->name (),
TYPE_FIELD_NAME (index_desc_type, 0)) == 0) TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
return; return;
@ -1622,7 +1622,7 @@ fat_pntr_bounds_bitsize (struct type *type)
if (TYPE_FIELD_BITSIZE (type, 1) > 0) if (TYPE_FIELD_BITSIZE (type, 1) > 0)
return TYPE_FIELD_BITSIZE (type, 1); return TYPE_FIELD_BITSIZE (type, 1);
else else
return 8 * TYPE_LENGTH (ada_check_typedef (TYPE_FIELD_TYPE (type, 1))); return 8 * TYPE_LENGTH (ada_check_typedef (type->field (1).type ()));
} }
/* If TYPE is the type of an array descriptor (fat or thin pointer) or a /* If TYPE is the type of an array descriptor (fat or thin pointer) or a
@ -1637,7 +1637,7 @@ desc_data_target_type (struct type *type)
/* NOTE: The following is bogus; see comment in desc_bounds. */ /* NOTE: The following is bogus; see comment in desc_bounds. */
if (is_thin_pntr (type)) if (is_thin_pntr (type))
return desc_base_type (TYPE_FIELD_TYPE (thin_descriptor_type (type), 1)); return desc_base_type (thin_descriptor_type (type)->field (1).type ());
else if (is_thick_pntr (type)) else if (is_thick_pntr (type))
{ {
struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1); struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1);
@ -1688,7 +1688,7 @@ fat_pntr_data_bitsize (struct type *type)
if (TYPE_FIELD_BITSIZE (type, 0) > 0) if (TYPE_FIELD_BITSIZE (type, 0) > 0)
return TYPE_FIELD_BITSIZE (type, 0); return TYPE_FIELD_BITSIZE (type, 0);
else else
return TARGET_CHAR_BIT * TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)); return TARGET_CHAR_BIT * TYPE_LENGTH (type->field (0).type ());
} }
/* If BOUNDS is an array-bounds structure (or pointer to one), return /* If BOUNDS is an array-bounds structure (or pointer to one), return
@ -1727,7 +1727,7 @@ desc_bound_bitsize (struct type *type, int i, int which)
if (TYPE_FIELD_BITSIZE (type, 2 * i + which - 2) > 0) if (TYPE_FIELD_BITSIZE (type, 2 * i + which - 2) > 0)
return TYPE_FIELD_BITSIZE (type, 2 * i + which - 2); return TYPE_FIELD_BITSIZE (type, 2 * i + which - 2);
else else
return 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (type, 2 * i + which - 2)); return 8 * TYPE_LENGTH (type->field (2 * i + which - 2).type ());
} }
/* If TYPE is the type of an array-bounds structure, the type of its /* If TYPE is the type of an array-bounds structure, the type of its
@ -2078,7 +2078,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
index_type_desc = ada_find_parallel_type (type, "___XA"); index_type_desc = ada_find_parallel_type (type, "___XA");
if (index_type_desc) if (index_type_desc)
index_type = to_fixed_range_type (TYPE_FIELD_TYPE (index_type_desc, 0), index_type = to_fixed_range_type (index_type_desc->field (0).type (),
NULL); NULL);
else else
index_type = type->index_type (); index_type = type->index_type ();
@ -2948,7 +2948,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
} }
if (index_type_desc != NULL) if (index_type_desc != NULL)
index_type = to_fixed_range_type (TYPE_FIELD_TYPE (index_type_desc, n - 1), index_type = to_fixed_range_type (index_type_desc->field (n - 1).type (),
NULL); NULL);
else else
{ {
@ -3163,7 +3163,7 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
{ {
if (i > 0) if (i > 0)
fprintf_filtered (stream, "; "); fprintf_filtered (stream, "; ");
ada_print_type (TYPE_FIELD_TYPE (type, i), NULL, stream, -1, 0, ada_print_type (type->field (i).type (), NULL, stream, -1, 0,
flags); flags);
} }
fprintf_filtered (stream, ")"); fprintf_filtered (stream, ")");
@ -3854,8 +3854,7 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
return 0; return 0;
else else
{ {
struct type *ftype = ada_check_typedef (TYPE_FIELD_TYPE (func_type, struct type *ftype = ada_check_typedef (func_type->field (i).type ());
i));
struct type *atype = ada_check_typedef (value_type (actuals[i])); struct type *atype = ada_check_typedef (value_type (actuals[i]));
if (!ada_type_match (ftype, atype, 1)) if (!ada_type_match (ftype, atype, 1))
@ -4505,14 +4504,14 @@ make_array_descriptor (struct type *type, struct value *arr)
modify_field (value_type (descriptor), modify_field (value_type (descriptor),
value_contents_writeable (descriptor), value_contents_writeable (descriptor),
value_pointer (ensure_lval (arr), value_pointer (ensure_lval (arr),
TYPE_FIELD_TYPE (desc_type, 0)), desc_type->field (0).type ()),
fat_pntr_data_bitpos (desc_type), fat_pntr_data_bitpos (desc_type),
fat_pntr_data_bitsize (desc_type)); fat_pntr_data_bitsize (desc_type));
modify_field (value_type (descriptor), modify_field (value_type (descriptor),
value_contents_writeable (descriptor), value_contents_writeable (descriptor),
value_pointer (bounds, value_pointer (bounds,
TYPE_FIELD_TYPE (desc_type, 1)), desc_type->field (1).type ()),
fat_pntr_bounds_bitpos (desc_type), fat_pntr_bounds_bitpos (desc_type),
fat_pntr_bounds_bitsize (desc_type)); fat_pntr_bounds_bitsize (desc_type));
@ -6480,8 +6479,8 @@ ada_is_ignored_field (struct type *type, int field_num)
/* If this is the dispatch table of a tagged type or an interface tag, /* If this is the dispatch table of a tagged type or an interface tag,
then ignore. */ then ignore. */
if (ada_is_tagged_type (type, 1) if (ada_is_tagged_type (type, 1)
&& (ada_is_dispatch_table_ptr_type (TYPE_FIELD_TYPE (type, field_num)) && (ada_is_dispatch_table_ptr_type (type->field (field_num).type ())
|| ada_is_interface_tag (TYPE_FIELD_TYPE (type, field_num)))) || ada_is_interface_tag (type->field (field_num).type ())))
return 1; return 1;
/* Not a special field, so it should not be ignored. */ /* Not a special field, so it should not be ignored. */
@ -6792,7 +6791,7 @@ ada_parent_type (struct type *type)
for (i = 0; i < type->num_fields (); i += 1) for (i = 0; i < type->num_fields (); i += 1)
if (ada_is_parent_field (type, i)) if (ada_is_parent_field (type, i))
{ {
struct type *parent_type = TYPE_FIELD_TYPE (type, i); struct type *parent_type = type->field (i).type ();
/* If the _parent field is a pointer, then dereference it. */ /* If the _parent field is a pointer, then dereference it. */
if (parent_type->code () == TYPE_CODE_PTR) if (parent_type->code () == TYPE_CODE_PTR)
@ -6860,7 +6859,7 @@ ada_is_variant_part (struct type *type, int field_num)
if (!ADA_TYPE_P (type)) if (!ADA_TYPE_P (type))
return 0; return 0;
struct type *field_type = TYPE_FIELD_TYPE (type, field_num); struct type *field_type = type->field (field_num).type ();
return (field_type->code () == TYPE_CODE_UNION return (field_type->code () == TYPE_CODE_UNION
|| (is_dynamic_field (type, field_num) || (is_dynamic_field (type, field_num)
@ -7049,7 +7048,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
struct type *type; struct type *type;
arg_type = ada_check_typedef (arg_type); arg_type = ada_check_typedef (arg_type);
type = TYPE_FIELD_TYPE (arg_type, fieldno); type = arg_type->field (fieldno).type ();
/* Handle packed fields. It might be that the field is not packed /* Handle packed fields. It might be that the field is not packed
relative to its containing structure, but the structure itself is relative to its containing structure, but the structure itself is
@ -7180,7 +7179,7 @@ find_struct_field (const char *name, struct type *type, int offset,
int bit_size = TYPE_FIELD_BITSIZE (type, i); int bit_size = TYPE_FIELD_BITSIZE (type, i);
if (field_type_p != NULL) if (field_type_p != NULL)
*field_type_p = TYPE_FIELD_TYPE (type, i); *field_type_p = type->field (i).type ();
if (byte_offset_p != NULL) if (byte_offset_p != NULL)
*byte_offset_p = fld_offset; *byte_offset_p = fld_offset;
if (bit_offset_p != NULL) if (bit_offset_p != NULL)
@ -7191,7 +7190,7 @@ find_struct_field (const char *name, struct type *type, int offset,
} }
else if (ada_is_wrapper_field (type, i)) else if (ada_is_wrapper_field (type, i))
{ {
if (find_struct_field (name, TYPE_FIELD_TYPE (type, i), fld_offset, if (find_struct_field (name, type->field (i).type (), fld_offset,
field_type_p, byte_offset_p, bit_offset_p, field_type_p, byte_offset_p, bit_offset_p,
bit_size_p, index_p)) bit_size_p, index_p))
return 1; return 1;
@ -7202,11 +7201,11 @@ find_struct_field (const char *name, struct type *type, int offset,
fixed type?? */ fixed type?? */
int j; int j;
struct type *field_type struct type *field_type
= ada_check_typedef (TYPE_FIELD_TYPE (type, i)); = ada_check_typedef (type->field (i).type ());
for (j = 0; j < field_type->num_fields (); j += 1) for (j = 0; j < field_type->num_fields (); j += 1)
{ {
if (find_struct_field (name, TYPE_FIELD_TYPE (field_type, j), if (find_struct_field (name, field_type->field (j).type (),
fld_offset fld_offset
+ TYPE_FIELD_BITPOS (field_type, j) / 8, + TYPE_FIELD_BITPOS (field_type, j) / 8,
field_type_p, byte_offset_p, field_type_p, byte_offset_p,
@ -7226,7 +7225,7 @@ find_struct_field (const char *name, struct type *type, int offset,
int bit_pos = TYPE_FIELD_BITPOS (type, parent_offset); int bit_pos = TYPE_FIELD_BITPOS (type, parent_offset);
int fld_offset = offset + bit_pos / 8; int fld_offset = offset + bit_pos / 8;
if (find_struct_field (name, TYPE_FIELD_TYPE (type, parent_offset), if (find_struct_field (name, type->field (parent_offset).type (),
fld_offset, field_type_p, byte_offset_p, fld_offset, field_type_p, byte_offset_p,
bit_offset_p, bit_size_p, index_p)) bit_offset_p, bit_size_p, index_p))
return 1; return 1;
@ -7293,7 +7292,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
struct value *v = /* Do not let indent join lines here. */ struct value *v = /* Do not let indent join lines here. */
ada_search_struct_field (name, arg, ada_search_struct_field (name, arg,
offset + TYPE_FIELD_BITPOS (type, i) / 8, offset + TYPE_FIELD_BITPOS (type, i) / 8,
TYPE_FIELD_TYPE (type, i)); type->field (i).type ());
if (v != NULL) if (v != NULL)
return v; return v;
@ -7303,8 +7302,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
{ {
/* PNH: Do we ever get here? See find_struct_field. */ /* PNH: Do we ever get here? See find_struct_field. */
int j; int j;
struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, struct type *field_type = ada_check_typedef (type->field (i).type ());
i));
int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
for (j = 0; j < field_type->num_fields (); j += 1) for (j = 0; j < field_type->num_fields (); j += 1)
@ -7313,7 +7311,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
break. */ break. */
(name, arg, (name, arg,
var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8, var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8,
TYPE_FIELD_TYPE (field_type, j)); field_type->field (j).type ());
if (v != NULL) if (v != NULL)
return v; return v;
@ -7328,7 +7326,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
{ {
struct value *v = ada_search_struct_field ( struct value *v = ada_search_struct_field (
name, arg, offset + TYPE_FIELD_BITPOS (type, parent_offset) / 8, name, arg, offset + TYPE_FIELD_BITPOS (type, parent_offset) / 8,
TYPE_FIELD_TYPE (type, parent_offset)); type->field (parent_offset).type ());
if (v != NULL) if (v != NULL)
return v; return v;
@ -7374,7 +7372,7 @@ ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
struct value *v = /* Do not let indent join lines here. */ struct value *v = /* Do not let indent join lines here. */
ada_index_struct_field_1 (index_p, arg, ada_index_struct_field_1 (index_p, arg,
offset + TYPE_FIELD_BITPOS (type, i) / 8, offset + TYPE_FIELD_BITPOS (type, i) / 8,
TYPE_FIELD_TYPE (type, i)); type->field (i).type ());
if (v != NULL) if (v != NULL)
return v; return v;
@ -7481,11 +7479,11 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
} }
else if (field_name_match (t_field_name, name)) else if (field_name_match (t_field_name, name))
return TYPE_FIELD_TYPE (type, i); return type->field (i).type ();
else if (ada_is_wrapper_field (type, i)) else if (ada_is_wrapper_field (type, i))
{ {
t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (type, i), name, t = ada_lookup_struct_elt_type (type->field (i).type (), name,
0, 1); 0, 1);
if (t != NULL) if (t != NULL)
return t; return t;
@ -7494,8 +7492,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
else if (ada_is_variant_part (type, i)) else if (ada_is_variant_part (type, i))
{ {
int j; int j;
struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, struct type *field_type = ada_check_typedef (type->field (i).type ());
i));
for (j = field_type->num_fields () - 1; j >= 0; j -= 1) for (j = field_type->num_fields () - 1; j >= 0; j -= 1)
{ {
@ -7507,10 +7504,9 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
if (v_field_name != NULL if (v_field_name != NULL
&& field_name_match (v_field_name, name)) && field_name_match (v_field_name, name))
t = TYPE_FIELD_TYPE (field_type, j); t = field_type->field (j).type ();
else else
t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (field_type, t = ada_lookup_struct_elt_type (field_type->field (j).type (),
j),
name, 0, 1); name, 0, 1);
if (t != NULL) if (t != NULL)
@ -7527,7 +7523,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
{ {
struct type *t; struct type *t;
t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (type, parent_offset), t = ada_lookup_struct_elt_type (type->field (parent_offset).type (),
name, 0, 1); name, 0, 1);
if (t != NULL) if (t != NULL)
return t; return t;
@ -7916,7 +7912,7 @@ is_dynamic_field (struct type *templ_type, int field_num)
const char *name = TYPE_FIELD_NAME (templ_type, field_num); const char *name = TYPE_FIELD_NAME (templ_type, field_num);
return name != NULL return name != NULL
&& TYPE_FIELD_TYPE (templ_type, field_num)->code () == TYPE_CODE_PTR && templ_type->field (field_num).type ()->code () == TYPE_CODE_PTR
&& strstr (name, "___XVL") != NULL; && strstr (name, "___XVL") != NULL;
} }
@ -8029,7 +8025,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
const gdb_byte *field_valaddr = valaddr; const gdb_byte *field_valaddr = valaddr;
CORE_ADDR field_address = address; CORE_ADDR field_address = address;
struct type *field_type = struct type *field_type =
TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, f)); TYPE_TARGET_TYPE (type->field (f).type ());
if (dval0 == NULL) if (dval0 == NULL)
{ {
@ -8097,7 +8093,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
adding overflow recovery code to this already complex code, adding overflow recovery code to this already complex code,
we just assume that it's not going to happen. */ we just assume that it's not going to happen. */
fld_bit_len = fld_bit_len =
TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, f)) * TARGET_CHAR_BIT; TYPE_LENGTH (rtype->field (f).type ()) * TARGET_CHAR_BIT;
} }
else else
{ {
@ -8111,14 +8107,14 @@ 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. */
rtype->field (f).set_type (TYPE_FIELD_TYPE (type, f)); rtype->field (f).set_type (type->field (f).type ());
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 =
TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f); TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f);
else else
{ {
struct type *field_type = TYPE_FIELD_TYPE (type, f); struct type *field_type = type->field (f).type ();
/* We need to be careful of typedefs when computing /* We need to be careful of typedefs when computing
the length of our field. If this is a typedef, the length of our field. If this is a typedef,
@ -8162,7 +8158,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
branch_type = branch_type =
to_fixed_variant_branch_type to_fixed_variant_branch_type
(TYPE_FIELD_TYPE (type, variant_field), (type->field (variant_field).type (),
cond_offset_host (valaddr, off / TARGET_CHAR_BIT), cond_offset_host (valaddr, off / TARGET_CHAR_BIT),
cond_offset_target (address, off / TARGET_CHAR_BIT), dval); cond_offset_target (address, off / TARGET_CHAR_BIT), dval);
if (branch_type == NULL) if (branch_type == NULL)
@ -8176,7 +8172,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
rtype->field (variant_field).set_type (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 (rtype->field (variant_field).type ()) *
TARGET_CHAR_BIT; TARGET_CHAR_BIT;
if (off + fld_bit_len > bit_len) if (off + fld_bit_len > bit_len)
bit_len = off + fld_bit_len; bit_len = off + fld_bit_len;
@ -8257,7 +8253,7 @@ template_to_static_fixed_type (struct type *type0)
for (f = 0; f < nfields; f += 1) for (f = 0; f < nfields; f += 1)
{ {
struct type *field_type = TYPE_FIELD_TYPE (type0, f); struct type *field_type = type0->field (f).type ();
struct type *new_type; struct type *new_type;
if (is_dynamic_field (type0, f)) if (is_dynamic_field (type0, f))
@ -8341,7 +8337,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
TYPE_LENGTH (rtype) = TYPE_LENGTH (type); TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
branch_type = to_fixed_variant_branch_type branch_type = to_fixed_variant_branch_type
(TYPE_FIELD_TYPE (type, variant_field), (type->field (variant_field).type (),
cond_offset_host (valaddr, cond_offset_host (valaddr,
TYPE_FIELD_BITPOS (type, variant_field) TYPE_FIELD_BITPOS (type, variant_field)
/ TARGET_CHAR_BIT), / TARGET_CHAR_BIT),
@ -8363,7 +8359,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
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);
} }
TYPE_LENGTH (rtype) -= TYPE_LENGTH (TYPE_FIELD_TYPE (type, variant_field)); TYPE_LENGTH (rtype) -= TYPE_LENGTH (type->field (variant_field).type ());
value_free_to_mark (mark); value_free_to_mark (mark);
return rtype; return rtype;
@ -8449,14 +8445,14 @@ to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr,
return empty_record (var_type); return empty_record (var_type);
else if (is_dynamic_field (var_type, which)) else if (is_dynamic_field (var_type, which))
return to_fixed_record_type return to_fixed_record_type
(TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (var_type, which)), (TYPE_TARGET_TYPE (var_type->field (which).type ()),
valaddr, address, dval); valaddr, address, dval);
else if (variant_field_index (TYPE_FIELD_TYPE (var_type, which)) >= 0) else if (variant_field_index (var_type->field (which).type ()) >= 0)
return return
to_fixed_record_type to_fixed_record_type
(TYPE_FIELD_TYPE (var_type, which), valaddr, address, dval); (var_type->field (which).type (), valaddr, address, dval);
else else
return TYPE_FIELD_TYPE (var_type, which); return var_type->field (which).type ();
} }
/* Assuming RANGE_TYPE is a TYPE_CODE_RANGE, return nonzero if /* Assuming RANGE_TYPE is a TYPE_CODE_RANGE, return nonzero if
@ -8523,7 +8519,7 @@ ada_is_redundant_index_type_desc (struct type *array_type,
for (i = 0; i < desc_type->num_fields (); i++) for (i = 0; i < desc_type->num_fields (); i++)
{ {
if (!ada_is_redundant_range_encoding (this_layer->index_type (), if (!ada_is_redundant_range_encoding (this_layer->index_type (),
TYPE_FIELD_TYPE (desc_type, i))) desc_type->field (i).type ()))
return 0; return 0;
this_layer = check_typedef (TYPE_TARGET_TYPE (this_layer)); this_layer = check_typedef (TYPE_TARGET_TYPE (this_layer));
} }
@ -8645,7 +8641,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
for (i = index_type_desc->num_fields () - 1; i >= 0; i -= 1) for (i = index_type_desc->num_fields () - 1; i >= 0; i -= 1)
{ {
struct type *range_type = struct type *range_type =
to_fixed_range_type (TYPE_FIELD_TYPE (index_type_desc, i), dval); to_fixed_range_type (index_type_desc->field (i).type (), dval);
result = create_array_type (alloc_type_copy (elt_type0), result = create_array_type (alloc_type_copy (elt_type0),
result, range_type); result, range_type);
@ -8900,7 +8896,7 @@ static_unwrap_type (struct type *type)
{ {
if (ada_is_aligner_type (type)) if (ada_is_aligner_type (type))
{ {
struct type *type1 = TYPE_FIELD_TYPE (ada_check_typedef (type), 0); struct type *type1 = ada_check_typedef (type)->field (0).type ();
if (ada_type_name (type1) == NULL) if (ada_type_name (type1) == NULL)
type1->set_name (ada_type_name (type)); type1->set_name (ada_type_name (type));
@ -9202,7 +9198,7 @@ ada_get_base_type (struct type *raw_type)
|| real_type_namer->num_fields () != 1) || real_type_namer->num_fields () != 1)
return raw_type; return raw_type;
if (TYPE_FIELD_TYPE (real_type_namer, 0)->code () != TYPE_CODE_REF) if (real_type_namer->field (0).type ()->code () != TYPE_CODE_REF)
{ {
/* This is an older encoding form where the base type needs to be /* This is an older encoding form where the base type needs to be
looked up by name. We prefer the newer encoding because it is looked up by name. We prefer the newer encoding because it is
@ -9215,7 +9211,7 @@ ada_get_base_type (struct type *raw_type)
} }
/* The field in our XVS type is a reference to the base type. */ /* The field in our XVS type is a reference to the base type. */
return TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (real_type_namer, 0)); return TYPE_TARGET_TYPE (real_type_namer->field (0).type ());
} }
/* The type of value designated by TYPE, with all aligners removed. */ /* The type of value designated by TYPE, with all aligners removed. */
@ -9224,7 +9220,7 @@ struct type *
ada_aligned_type (struct type *type) ada_aligned_type (struct type *type)
{ {
if (ada_is_aligner_type (type)) if (ada_is_aligner_type (type))
return ada_aligned_type (TYPE_FIELD_TYPE (type, 0)); return ada_aligned_type (type->field (0).type ());
else else
return ada_get_base_type (type); return ada_get_base_type (type);
} }
@ -9237,7 +9233,7 @@ const gdb_byte *
ada_aligned_value_addr (struct type *type, const gdb_byte *valaddr) ada_aligned_value_addr (struct type *type, const gdb_byte *valaddr)
{ {
if (ada_is_aligner_type (type)) if (ada_is_aligner_type (type))
return ada_aligned_value_addr (TYPE_FIELD_TYPE (type, 0), return ada_aligned_value_addr (type->field (0).type (),
valaddr + valaddr +
TYPE_FIELD_BITPOS (type, TYPE_FIELD_BITPOS (type,
0) / TARGET_CHAR_BIT); 0) / TARGET_CHAR_BIT);

View File

@ -430,7 +430,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len)
array_fieldno = ada_get_field_index (type, "P_ARRAY", 0); array_fieldno = ada_get_field_index (type, "P_ARRAY", 0);
bounds_fieldno = ada_get_field_index (type, "P_BOUNDS", 0); bounds_fieldno = ada_get_field_index (type, "P_BOUNDS", 0);
bounds_type = TYPE_FIELD_TYPE (type, bounds_fieldno); bounds_type = type->field (bounds_fieldno).type ();
if (bounds_type->code () == TYPE_CODE_PTR) if (bounds_type->code () == TYPE_CODE_PTR)
bounds_type = TYPE_TARGET_TYPE (bounds_type); bounds_type = TYPE_TARGET_TYPE (bounds_type);
if (bounds_type->code () != TYPE_CODE_STRUCT) if (bounds_type->code () != TYPE_CODE_STRUCT)

View File

@ -424,7 +424,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
{ {
if (k > 0) if (k > 0)
fprintf_filtered (stream, ", "); fprintf_filtered (stream, ", ");
print_range_type (TYPE_FIELD_TYPE (range_desc_type, k), print_range_type (range_desc_type->field (k).type (),
stream, 0 /* bounds_prefered_p */); stream, 0 /* bounds_prefered_p */);
if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0) if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
bitsize = TYPE_FIELD_BITSIZE (arr_type, 0); bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
@ -549,7 +549,7 @@ print_variant_clauses (struct type *type, int field_num,
struct type *var_type, *par_type; struct type *var_type, *par_type;
struct type *discr_type; struct type *discr_type;
var_type = TYPE_FIELD_TYPE (type, field_num); var_type = type->field (field_num).type ();
discr_type = ada_variant_discrim_type (var_type, outer_type); discr_type = ada_variant_discrim_type (var_type, outer_type);
if (var_type->code () == TYPE_CODE_PTR) if (var_type->code () == TYPE_CODE_PTR)
@ -568,7 +568,7 @@ print_variant_clauses (struct type *type, int field_num,
fprintf_filtered (stream, "\n%*swhen ", level + 4, ""); fprintf_filtered (stream, "\n%*swhen ", level + 4, "");
if (print_choices (var_type, i, stream, discr_type)) if (print_choices (var_type, i, stream, discr_type))
{ {
if (print_record_field_types (TYPE_FIELD_TYPE (var_type, i), if (print_record_field_types (var_type->field (i).type (),
outer_type, stream, show, level + 4, outer_type, stream, show, level + 4,
flags) flags)
<= 0) <= 0)
@ -594,7 +594,7 @@ print_variant_part (struct type *type, int field_num, struct type *outer_type,
const struct type_print_options *flags) const struct type_print_options *flags)
{ {
const char *variant const char *variant
= ada_variant_discrim_name (TYPE_FIELD_TYPE (type, field_num)); = ada_variant_discrim_name (type->field (field_num).type ());
if (*variant == '\0') if (*variant == '\0')
variant = "?"; variant = "?";
@ -633,7 +633,7 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
if (ada_is_parent_field (type, i) || ada_is_ignored_field (type, i)) if (ada_is_parent_field (type, i) || ada_is_ignored_field (type, i))
; ;
else if (ada_is_wrapper_field (type, i)) else if (ada_is_wrapper_field (type, i))
flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type, flds += print_record_field_types (type->field (i).type (), type,
stream, show, level, flags); stream, show, level, flags);
else if (ada_is_variant_part (type, i)) else if (ada_is_variant_part (type, i))
{ {
@ -644,7 +644,7 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
{ {
flds += 1; flds += 1;
fprintf_filtered (stream, "\n%*s", level + 4, ""); fprintf_filtered (stream, "\n%*s", level + 4, "");
ada_print_type (TYPE_FIELD_TYPE (type, i), ada_print_type (type->field (i).type (),
TYPE_FIELD_NAME (type, i), TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 4, flags); stream, show - 1, level + 4, flags);
fprintf_filtered (stream, ";"); fprintf_filtered (stream, ";");
@ -708,7 +708,7 @@ print_variant_part (const variant_part &part,
else else
{ {
name = TYPE_FIELD_NAME (type, part.discriminant_index); name = TYPE_FIELD_NAME (type, part.discriminant_index);
discr_type = TYPE_FIELD_TYPE (type, part.discriminant_index); discr_type = type->field (part.discriminant_index).type ();
} }
fprintf_filtered (stream, "\n%*scase %s is", level + 4, "", name); fprintf_filtered (stream, "\n%*scase %s is", level + 4, "", name);
@ -875,7 +875,7 @@ print_unchecked_union_type (struct type *type, struct ui_file *stream,
{ {
fprintf_filtered (stream, "\n%*swhen ? =>\n%*s", level + 8, "", fprintf_filtered (stream, "\n%*swhen ? =>\n%*s", level + 8, "",
level + 12, ""); level + 12, "");
ada_print_type (TYPE_FIELD_TYPE (type, i), ada_print_type (type->field (i).type (),
TYPE_FIELD_NAME (type, i), TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 12, flags); stream, show - 1, level + 12, flags);
fprintf_filtered (stream, ";"); fprintf_filtered (stream, ";");
@ -920,7 +920,7 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name,
wrap_here (" "); wrap_here (" ");
} }
fprintf_filtered (stream, "a%d: ", i + 1); fprintf_filtered (stream, "a%d: ", i + 1);
ada_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0, ada_print_type (type->field (i).type (), "", stream, -1, 0,
flags); flags);
} }
fprintf_filtered (stream, ")"); fprintf_filtered (stream, ")");

View File

@ -542,7 +542,7 @@ print_variant_part (struct value *value, int field_num,
const struct language_defn *language) const struct language_defn *language)
{ {
struct type *type = value_type (value); struct type *type = value_type (value);
struct type *var_type = TYPE_FIELD_TYPE (type, field_num); struct type *var_type = type->field (field_num).type ();
int which = ada_which_variant_applies (var_type, outer_value); int which = ada_which_variant_applies (var_type, outer_value);
if (which < 0) if (which < 0)
@ -617,7 +617,7 @@ print_field_values (struct value *value, struct value *outer_value,
wrap_here (n_spaces (2 + 2 * recurse)); wrap_here (n_spaces (2 + 2 * recurse));
} }
annotate_field_begin (TYPE_FIELD_TYPE (type, i)); annotate_field_begin (type->field (i).type ());
fprintf_filtered (stream, "%.*s", fprintf_filtered (stream, "%.*s",
ada_name_prefix_len (TYPE_FIELD_NAME (type, i)), ada_name_prefix_len (TYPE_FIELD_NAME (type, i)),
TYPE_FIELD_NAME (type, i)); TYPE_FIELD_NAME (type, i));
@ -641,12 +641,12 @@ print_field_values (struct value *value, struct value *outer_value,
int bit_size = TYPE_FIELD_BITSIZE (type, i); int bit_size = TYPE_FIELD_BITSIZE (type, i);
struct value_print_options opts; struct value_print_options opts;
adjust_type_signedness (TYPE_FIELD_TYPE (type, i)); adjust_type_signedness (type->field (i).type ());
v = ada_value_primitive_packed_val v = ada_value_primitive_packed_val
(value, nullptr, (value, nullptr,
bit_pos / HOST_CHAR_BIT, bit_pos / HOST_CHAR_BIT,
bit_pos % HOST_CHAR_BIT, bit_pos % HOST_CHAR_BIT,
bit_size, TYPE_FIELD_TYPE (type, i)); bit_size, type->field (i).type ());
opts = *options; opts = *options;
opts.deref_ref = 0; opts.deref_ref = 0;
common_val_print (v, stream, recurse + 1, &opts, language); common_val_print (v, stream, recurse + 1, &opts, language);

View File

@ -105,7 +105,7 @@ ada_varobj_struct_elt (struct value *parent_value,
type = value_type (value); type = value_type (value);
} }
else else
type = TYPE_FIELD_TYPE (parent_type, fieldno); type = parent_type->field (fieldno).type ();
if (child_value) if (child_value)
*child_value = value; *child_value = value;

View File

@ -551,7 +551,7 @@ amd64_has_unaligned_fields (struct type *type)
{ {
for (int i = 0; i < type->num_fields (); i++) for (int i = 0; i < type->num_fields (); i++)
{ {
struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); struct type *subtype = check_typedef (type->field (i).type ());
int bitpos = TYPE_FIELD_BITPOS (type, i); int bitpos = TYPE_FIELD_BITPOS (type, i);
int align = type_align(subtype); int align = type_align(subtype);
@ -587,7 +587,7 @@ amd64_classify_aggregate_field (struct type *type, int i,
enum amd64_reg_class theclass[2], enum amd64_reg_class theclass[2],
unsigned int bitoffset) unsigned int bitoffset)
{ {
struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); struct type *subtype = check_typedef (type->field (i).type ());
int bitpos = bitoffset + TYPE_FIELD_BITPOS (type, i); int bitpos = bitoffset + TYPE_FIELD_BITPOS (type, i);
int pos = bitpos / 64; int pos = bitpos / 64;
enum amd64_reg_class subclass[2]; enum amd64_reg_class subclass[2];

View File

@ -3502,7 +3502,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
int sub_count = 0; int sub_count = 0;
if (!field_is_static (&t->field (i))) if (!field_is_static (&t->field (i)))
sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), sub_count = arm_vfp_cprc_sub_candidate (t->field (i).type (),
base_type); base_type);
if (sub_count == -1) if (sub_count == -1)
return -1; return -1;
@ -3528,7 +3528,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
int i; int i;
for (i = 0; i < t->num_fields (); i++) for (i = 0; i < t->num_fields (); i++)
{ {
int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), int sub_count = arm_vfp_cprc_sub_candidate (t->field (i).type (),
base_type); base_type);
if (sub_count == -1) if (sub_count == -1)
return -1; return -1;
@ -7975,7 +7975,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
enum type_code field_type_code; enum type_code field_type_code;
field_type_code field_type_code
= check_typedef (TYPE_FIELD_TYPE (type, i))->code (); = check_typedef (type->field (i).type ())->code ();
/* Is it a floating point type field? */ /* Is it a floating point type field? */
if (field_type_code == TYPE_CODE_FLT) if (field_type_code == TYPE_CODE_FLT)

View File

@ -1417,7 +1417,7 @@ gen_primitive_field (struct agent_expr *ax, struct axs_value *value,
{ {
/* Is this a bitfield? */ /* Is this a bitfield? */
if (TYPE_FIELD_PACKED (type, fieldno)) if (TYPE_FIELD_PACKED (type, fieldno))
gen_bitfield_ref (ax, value, TYPE_FIELD_TYPE (type, fieldno), gen_bitfield_ref (ax, value, type->field (fieldno).type (),
(offset * TARGET_CHAR_BIT (offset * TARGET_CHAR_BIT
+ TYPE_FIELD_BITPOS (type, fieldno)), + TYPE_FIELD_BITPOS (type, fieldno)),
(offset * TARGET_CHAR_BIT (offset * TARGET_CHAR_BIT
@ -1428,7 +1428,7 @@ gen_primitive_field (struct agent_expr *ax, struct axs_value *value,
gen_offset (ax, offset gen_offset (ax, offset
+ TYPE_FIELD_BITPOS (type, fieldno) / TARGET_CHAR_BIT); + TYPE_FIELD_BITPOS (type, fieldno) / TARGET_CHAR_BIT);
value->kind = axs_lvalue_memory; value->kind = axs_lvalue_memory;
value->type = TYPE_FIELD_TYPE (type, fieldno); value->type = type->field (fieldno).type ();
} }
} }
@ -1551,7 +1551,7 @@ gen_static_field (struct agent_expr *ax, struct axs_value *value,
{ {
ax_const_l (ax, TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)); ax_const_l (ax, TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
value->kind = axs_lvalue_memory; value->kind = axs_lvalue_memory;
value->type = TYPE_FIELD_TYPE (type, fieldno); value->type = type->field (fieldno).type ();
value->optimized_out = 0; value->optimized_out = 0;
} }
else else

View File

@ -257,11 +257,11 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
/* If we know the size of the array, we can use it as a limit on /* If we know the size of the array, we can use it as a limit on
the number of characters to be fetched. */ the number of characters to be fetched. */
if (type->num_fields () == 1 if (type->num_fields () == 1
&& TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_RANGE) && type->field (0).type ()->code () == TYPE_CODE_RANGE)
{ {
LONGEST low_bound, high_bound; LONGEST low_bound, high_bound;
get_discrete_bounds (TYPE_FIELD_TYPE (type, 0), get_discrete_bounds (type->field (0).type (),
&low_bound, &high_bound); &low_bound, &high_bound);
fetchlimit = high_bound - low_bound + 1; fetchlimit = high_bound - low_bound + 1;
} }

View File

@ -573,7 +573,7 @@ c_type_print_args (struct type *type, struct ui_file *stream,
wrap_here (" "); wrap_here (" ");
} }
param_type = TYPE_FIELD_TYPE (type, i); param_type = type->field (i).type ();
if (language == language_cplus && linkage_name) if (language == language_cplus && linkage_name)
{ {
@ -1179,8 +1179,8 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
int newshow = show - 1; int newshow = show - 1;
if (!is_static && flags->print_offsets if (!is_static && flags->print_offsets
&& (TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_STRUCT && (type->field (i).type ()->code () == TYPE_CODE_STRUCT
|| TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_UNION)) || type->field (i).type ()->code () == TYPE_CODE_UNION))
{ {
/* If we're printing offsets and this field's type is /* If we're printing offsets and this field's type is
either a struct or an union, then we're interested in either a struct or an union, then we're interested in
@ -1200,10 +1200,10 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
the whole struct/union. */ the whole struct/union. */
local_podata.end_bitpos local_podata.end_bitpos
= podata->end_bitpos = podata->end_bitpos
- TYPE_LENGTH (TYPE_FIELD_TYPE (type, i)) * TARGET_CHAR_BIT; - TYPE_LENGTH (type->field (i).type ()) * TARGET_CHAR_BIT;
} }
c_print_type_1 (TYPE_FIELD_TYPE (type, i), c_print_type_1 (type->field (i).type (),
TYPE_FIELD_NAME (type, i), TYPE_FIELD_NAME (type, i),
stream, newshow, level + 4, stream, newshow, level + 4,
language, &local_flags, &local_podata); language, &local_flags, &local_podata);
@ -1645,7 +1645,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
print_spaces_filtered (level + 4, stream); print_spaces_filtered (level + 4, stream);
/* We pass "show" here and not "show - 1" to get enum types /* We pass "show" here and not "show - 1" to get enum types
printed. There's no other way to see them. */ printed. There's no other way to see them. */
c_print_type_1 (TYPE_FIELD_TYPE (type, i), c_print_type_1 (type->field (i).type (),
TYPE_FIELD_NAME (type, i), TYPE_FIELD_NAME (type, i),
stream, show, level + 4, stream, show, level + 4,
language, &local_flags, podata); language, &local_flags, podata);

View File

@ -375,7 +375,7 @@ c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
TYPE_CODE_PTR.) */ TYPE_CODE_PTR.) */
struct gdbarch *gdbarch = get_type_arch (type); struct gdbarch *gdbarch = get_type_arch (type);
int offset = TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8; int offset = TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8;
struct type *field_type = TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET); struct type *field_type = type->field (VTBL_FNADDR_OFFSET).type ();
const gdb_byte *valaddr = value_contents_for_printing (val); const gdb_byte *valaddr = value_contents_for_printing (val);
CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type); CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);

View File

@ -348,7 +348,7 @@ c_describe_child (const struct varobj *parent, int index,
{ {
if (cname) if (cname)
{ {
if (TYPE_FIELD_TYPE (type, index)->code () if (type->field (index).type ()->code ()
== TYPE_CODE_STRUCT) == TYPE_CODE_STRUCT)
*cname = ANONYMOUS_STRUCT_NAME; *cname = ANONYMOUS_STRUCT_NAME;
else else
@ -380,7 +380,7 @@ c_describe_child (const struct varobj *parent, int index,
} }
if (ctype) if (ctype)
*ctype = TYPE_FIELD_TYPE (type, index); *ctype = type->field (index).type ();
} }
break; break;
@ -771,10 +771,10 @@ cplus_describe_child (const struct varobj *parent, int index,
{ {
if (cname) if (cname)
{ {
if (TYPE_FIELD_TYPE (type, type_index)->code () if (type->field (type_index).type ()->code ()
== TYPE_CODE_STRUCT) == TYPE_CODE_STRUCT)
*cname = ANONYMOUS_STRUCT_NAME; *cname = ANONYMOUS_STRUCT_NAME;
else if (TYPE_FIELD_TYPE (type, type_index)->code () else if (type->field (type_index).type ()->code ()
== TYPE_CODE_UNION) == TYPE_CODE_UNION)
*cname = ANONYMOUS_UNION_NAME; *cname = ANONYMOUS_UNION_NAME;
} }
@ -797,7 +797,7 @@ cplus_describe_child (const struct varobj *parent, int index,
*cvalue = value_struct_element_index (value, type_index); *cvalue = value_struct_element_index (value, type_index);
if (ctype) if (ctype)
*ctype = TYPE_FIELD_TYPE (type, type_index); *ctype = type->field (type_index).type ();
} }
else if (index < TYPE_N_BASECLASSES (type)) else if (index < TYPE_N_BASECLASSES (type))
{ {
@ -806,11 +806,11 @@ cplus_describe_child (const struct varobj *parent, int index,
*cname = TYPE_FIELD_NAME (type, index); *cname = TYPE_FIELD_NAME (type, index);
if (cvalue && value) if (cvalue && value)
*cvalue = value_cast (TYPE_FIELD_TYPE (type, index), value); *cvalue = value_cast (type->field (index).type (), value);
if (ctype) if (ctype)
{ {
*ctype = TYPE_FIELD_TYPE (type, index); *ctype = type->field (index).type ();
} }
if (cfull_expression) if (cfull_expression)

View File

@ -529,7 +529,7 @@ generate_vla_size (compile_instance *compiler,
for (i = 0; i < type->num_fields (); ++i) for (i = 0; i < type->num_fields (); ++i)
if (!field_is_static (&type->field (i))) if (!field_is_static (&type->field (i)))
generate_vla_size (compiler, stream, gdbarch, registers_used, pc, generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
TYPE_FIELD_TYPE (type, i), sym); type->field (i).type (), sym);
} }
break; break;
} }

View File

@ -108,9 +108,9 @@ convert_struct_or_union (compile_c_instance *context, struct type *type)
gcc_type field_type; gcc_type field_type;
unsigned long bitsize = TYPE_FIELD_BITSIZE (type, i); unsigned long bitsize = TYPE_FIELD_BITSIZE (type, i);
field_type = context->convert_type (TYPE_FIELD_TYPE (type, i)); field_type = context->convert_type (type->field (i).type ());
if (bitsize == 0) if (bitsize == 0)
bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (type, i)); bitsize = 8 * TYPE_LENGTH (type->field (i).type ());
context->plugin ().build_add_field (result, context->plugin ().build_add_field (result,
TYPE_FIELD_NAME (type, i), TYPE_FIELD_NAME (type, i),
field_type, field_type,
@ -178,7 +178,7 @@ convert_func (compile_c_instance *context, struct type *type)
array.n_elements = type->num_fields (); array.n_elements = type->num_fields ();
array.elements = XNEWVEC (gcc_type, type->num_fields ()); array.elements = XNEWVEC (gcc_type, type->num_fields ());
for (i = 0; i < type->num_fields (); ++i) for (i = 0; i < type->num_fields (); ++i)
array.elements[i] = context->convert_type (TYPE_FIELD_TYPE (type, i)); array.elements[i] = context->convert_type (type->field (i).type ());
result = context->plugin ().build_function_type (return_type, result = context->plugin ().build_function_type (return_type,
&array, is_varargs); &array, is_varargs);

View File

@ -593,7 +593,7 @@ compile_cplus_convert_struct_or_union_members
field_name = nullptr; field_name = nullptr;
gcc_type field_type gcc_type field_type
= instance->convert_type (TYPE_FIELD_TYPE (type, i)); = instance->convert_type (type->field (i).type ());
if (field_is_static (&type->field (i))) if (field_is_static (&type->field (i)))
{ {
@ -648,7 +648,7 @@ compile_cplus_convert_struct_or_union_members
| get_field_access_flag (type, i); | get_field_access_flag (type, i);
if (bitsize == 0) if (bitsize == 0)
bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (type, i)); bitsize = 8 * TYPE_LENGTH (type->field (i).type ());
instance->plugin ().build_field instance->plugin ().build_field
(field_name, field_type, field_flags, bitsize, (field_name, field_type, field_flags, bitsize,
@ -998,7 +998,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
else else
{ {
array.elements[i - artificials] array.elements[i - artificials]
= instance->convert_type (TYPE_FIELD_TYPE (type, i)); = instance->convert_type (type->field (i).type ());
} }
} }

View File

@ -508,7 +508,7 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile)
if (func_type->num_fields () == 0) if (func_type->num_fields () == 0)
return NULL; return NULL;
regsp_type = check_typedef (TYPE_FIELD_TYPE (func_type, 0)); regsp_type = check_typedef (func_type->field (0).type ());
if (regsp_type->code () != TYPE_CODE_PTR) if (regsp_type->code () != TYPE_CODE_PTR)
error (_("Invalid type code %d of first parameter of function \"%s\" " error (_("Invalid type code %d of first parameter of function \"%s\" "
"in compiled module \"%s\"."), "in compiled module \"%s\"."),
@ -540,8 +540,8 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
ULONGEST reg_bitpos = TYPE_FIELD_BITPOS (regs_type, fieldno); ULONGEST reg_bitpos = TYPE_FIELD_BITPOS (regs_type, fieldno);
ULONGEST reg_bitsize = TYPE_FIELD_BITSIZE (regs_type, fieldno); ULONGEST reg_bitsize = TYPE_FIELD_BITSIZE (regs_type, fieldno);
ULONGEST reg_offset; ULONGEST reg_offset;
struct type *reg_type = check_typedef (TYPE_FIELD_TYPE (regs_type, struct type *reg_type
fieldno)); = check_typedef (regs_type->field (fieldno).type ());
ULONGEST reg_size = TYPE_LENGTH (reg_type); ULONGEST reg_size = TYPE_LENGTH (reg_type);
int regnum; int regnum;
struct value *regval; struct value *regval;

View File

@ -158,14 +158,14 @@ compile_object_run (struct compile_module *module)
{ {
gdb_assert (regs_addr != 0); gdb_assert (regs_addr != 0);
vargs[current_arg] = value_from_pointer vargs[current_arg] = value_from_pointer
(TYPE_FIELD_TYPE (func_type, current_arg), regs_addr); (func_type->field (current_arg).type (), regs_addr);
++current_arg; ++current_arg;
} }
if (func_type->num_fields () >= 2) if (func_type->num_fields () >= 2)
{ {
gdb_assert (data->out_value_addr != 0); gdb_assert (data->out_value_addr != 0);
vargs[current_arg] = value_from_pointer vargs[current_arg] = value_from_pointer
(TYPE_FIELD_TYPE (func_type, current_arg), data->out_value_addr); (func_type->field (current_arg).type (), data->out_value_addr);
++current_arg; ++current_arg;
} }
gdb_assert (current_arg == func_type->num_fields ()); gdb_assert (current_arg == func_type->num_fields ());

View File

@ -1103,10 +1103,10 @@ add_struct_fields (struct type *type, completion_list &output,
fieldname, namelen)) fieldname, namelen))
output.emplace_back (xstrdup (TYPE_FIELD_NAME (type, i))); output.emplace_back (xstrdup (TYPE_FIELD_NAME (type, i)));
} }
else if (TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_UNION) else if (type->field (i).type ()->code () == TYPE_CODE_UNION)
{ {
/* Recurse into anonymous unions. */ /* Recurse into anonymous unions. */
add_struct_fields (TYPE_FIELD_TYPE (type, i), add_struct_fields (type->field (i).type (),
output, fieldname, namelen); output, fieldname, namelen);
} }
} }

View File

@ -223,7 +223,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
wrap_here (n_spaces (2 + 2 * recurse)); wrap_here (n_spaces (2 + 2 * recurse));
} }
annotate_field_begin (TYPE_FIELD_TYPE (type, i)); annotate_field_begin (type->field (i).type ());
if (field_is_static (&type->field (i))) if (field_is_static (&type->field (i)))
{ {
@ -301,7 +301,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
{ {
struct value *v = value_static_field (type, i); struct value *v = value_static_field (type, i);
cp_print_static_field (TYPE_FIELD_TYPE (type, i), cp_print_static_field (type->field (i).type (),
v, stream, recurse + 1, v, stream, recurse + 1,
opts); opts);
} }
@ -315,7 +315,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
else if (i == vptr_fieldno && type == vptr_basetype) else if (i == vptr_fieldno && type == vptr_basetype)
{ {
int i_offset = TYPE_FIELD_BITPOS (type, i) / 8; int i_offset = TYPE_FIELD_BITPOS (type, i) / 8;
struct type *i_type = TYPE_FIELD_TYPE (type, i); struct type *i_type = type->field (i).type ();
if (valprint_check_validity (stream, i_type, i_offset, val)) if (valprint_check_validity (stream, i_type, i_offset, val))
{ {
@ -655,11 +655,11 @@ cp_find_class_member (struct type **self_p, int *fieldno,
for (i = 0; i < TYPE_N_BASECLASSES (self); i++) for (i = 0; i < TYPE_N_BASECLASSES (self); i++)
{ {
LONGEST bitpos = TYPE_FIELD_BITPOS (self, i); LONGEST bitpos = TYPE_FIELD_BITPOS (self, i);
LONGEST bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (self, i)); LONGEST bitsize = 8 * TYPE_LENGTH (self->field (i).type ());
if (offset >= bitpos && offset < bitpos + bitsize) if (offset >= bitpos && offset < bitpos + bitsize)
{ {
*self_p = TYPE_FIELD_TYPE (self, i); *self_p = self->field (i).type ();
cp_find_class_member (self_p, fieldno, offset - bitpos); cp_find_class_member (self_p, fieldno, offset - bitpos);
return; return;
} }

View File

@ -35,7 +35,7 @@ dynamic_array_type (struct type *type,
const struct value_print_options *options) const struct value_print_options *options)
{ {
if (type->num_fields () == 2 if (type->num_fields () == 2
&& TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_INT && type->field (0).type ()->code () == TYPE_CODE_INT
&& strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0 && strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0
&& strcmp (TYPE_FIELD_NAME (type, 1), "ptr") == 0 && strcmp (TYPE_FIELD_NAME (type, 1), "ptr") == 0
&& !value_bits_any_optimized_out (val, && !value_bits_any_optimized_out (val,
@ -52,7 +52,7 @@ dynamic_array_type (struct type *type,
length = unpack_field_as_long (type, valaddr + embedded_offset, 0); length = unpack_field_as_long (type, valaddr + embedded_offset, 0);
ptr_type = TYPE_FIELD_TYPE (type, 1); ptr_type = type->field (1).type ();
elttype = check_typedef (TYPE_TARGET_TYPE (ptr_type)); elttype = check_typedef (TYPE_TARGET_TYPE (ptr_type));
addr = unpack_pointer (ptr_type, addr = unpack_pointer (ptr_type,
valaddr + TYPE_FIELD_BITPOS (type, 1) / 8 valaddr + TYPE_FIELD_BITPOS (type, 1) / 8

View File

@ -9418,8 +9418,7 @@ alloc_rust_variant (struct obstack *obstack, struct type *type,
variant_part *part = new (obstack) variant_part; variant_part *part = new (obstack) variant_part;
part->discriminant_index = discriminant_index; part->discriminant_index = discriminant_index;
part->is_unsigned = TYPE_UNSIGNED (TYPE_FIELD_TYPE (type, part->is_unsigned = TYPE_UNSIGNED (type->field (discriminant_index).type ());
discriminant_index));
part->variants = gdb::array_view<variant> (variants, n_variants); part->variants = gdb::array_view<variant> (variants, n_variants);
void *storage = obstack_alloc (obstack, sizeof (gdb::array_view<variant_part>)); void *storage = obstack_alloc (obstack, sizeof (gdb::array_view<variant_part>));
@ -9471,7 +9470,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* Decode the field name to find the offset of the /* Decode the field name to find the offset of the
discriminant. */ discriminant. */
ULONGEST bit_offset = 0; ULONGEST bit_offset = 0;
struct type *field_type = TYPE_FIELD_TYPE (type, 0); struct type *field_type = type->field (0).type ();
while (name[0] >= '0' && name[0] <= '9') while (name[0] >= '0' && name[0] <= '9')
{ {
char *tail; char *tail;
@ -9491,7 +9490,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
++name; ++name;
bit_offset += TYPE_FIELD_BITPOS (field_type, index); bit_offset += TYPE_FIELD_BITPOS (field_type, index);
field_type = TYPE_FIELD_TYPE (field_type, index); field_type = field_type->field (index).type ();
} }
/* Smash this type to be a structure type. We have to do this /* Smash this type to be a structure type. We have to do this
@ -9513,8 +9512,8 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
field at index 1 and the data-less field at index 2. */ field at index 1 and the data-less field at index 2. */
type->field (1) = saved_field; type->field (1) = saved_field;
TYPE_FIELD_NAME (type, 1) TYPE_FIELD_NAME (type, 1)
= rust_last_path_segment (TYPE_FIELD_TYPE (type, 1)->name ()); = rust_last_path_segment (type->field (1).type ()->name ());
TYPE_FIELD_TYPE (type, 1)->set_name type->field (1).type ()->set_name
(rust_fully_qualify (&objfile->objfile_obstack, type->name (), (rust_fully_qualify (&objfile->objfile_obstack, type->name (),
TYPE_FIELD_NAME (type, 1))); TYPE_FIELD_NAME (type, 1)));
@ -9541,7 +9540,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
because the type has already been recorded. */ because the type has already been recorded. */
type->set_code (TYPE_CODE_STRUCT); type->set_code (TYPE_CODE_STRUCT);
struct type *field_type = TYPE_FIELD_TYPE (type, 0); struct type *field_type = type->field (0).type ();
const char *variant_name const char *variant_name
= rust_last_path_segment (field_type->name ()); = rust_last_path_segment (field_type->name ());
TYPE_FIELD_NAME (type, 0) = variant_name; TYPE_FIELD_NAME (type, 0) = variant_name;
@ -9554,7 +9553,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
struct type *disr_type = nullptr; struct type *disr_type = nullptr;
for (int i = 0; i < type->num_fields (); ++i) for (int i = 0; i < type->num_fields (); ++i)
{ {
disr_type = TYPE_FIELD_TYPE (type, i); disr_type = type->field (i).type ();
if (disr_type->code () != TYPE_CODE_STRUCT) if (disr_type->code () != TYPE_CODE_STRUCT)
{ {
@ -9631,7 +9630,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
That name can be used to look up the correct That name can be used to look up the correct
discriminant. */ discriminant. */
const char *variant_name const char *variant_name
= rust_last_path_segment (TYPE_FIELD_TYPE (type, i)->name ()); = rust_last_path_segment (type->field (i).type ()->name ());
auto iter = discriminant_map.find (variant_name); auto iter = discriminant_map.find (variant_name);
if (iter != discriminant_map.end ()) if (iter != discriminant_map.end ())
@ -9641,7 +9640,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
} }
/* Remove the discriminant field, if it exists. */ /* Remove the discriminant field, if it exists. */
struct type *sub_type = TYPE_FIELD_TYPE (type, i); struct type *sub_type = type->field (i).type ();
if (sub_type->num_fields () > 0) if (sub_type->num_fields () > 0)
{ {
sub_type->set_num_fields (sub_type->num_fields () - 1); sub_type->set_num_fields (sub_type->num_fields () - 1);
@ -10482,9 +10481,8 @@ dwarf2_compute_name (const char *name,
the two cases. */ the two cases. */
if (type->num_fields () > 0 if (type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0) && TYPE_FIELD_ARTIFICIAL (type, 0)
&& TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR && type->field (0).type ()->code () == TYPE_CODE_PTR
&& TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, && TYPE_CONST (TYPE_TARGET_TYPE (type->field (0).type ())))
0))))
buf.puts (" const"); buf.puts (" const");
} }
} }
@ -15242,7 +15240,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
else else
{ {
fnp->fcontext fnp->fcontext
= TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (this_type, 0)); = TYPE_TARGET_TYPE (this_type->field (0).type ());
} }
} }
} }
@ -15340,7 +15338,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
return; return;
/* Find the type of the method. */ /* Find the type of the method. */
pfn_type = TYPE_FIELD_TYPE (type, 0); pfn_type = type->field (0).type ();
if (pfn_type == NULL if (pfn_type == NULL
|| pfn_type->code () != TYPE_CODE_PTR || pfn_type->code () != TYPE_CODE_PTR
|| TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC) || TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC)
@ -15349,11 +15347,11 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
/* Look for the "this" argument. */ /* Look for the "this" argument. */
pfn_type = TYPE_TARGET_TYPE (pfn_type); pfn_type = TYPE_TARGET_TYPE (pfn_type);
if (pfn_type->num_fields () == 0 if (pfn_type->num_fields () == 0
/* || TYPE_FIELD_TYPE (pfn_type, 0) == NULL */ /* || pfn_type->field (0).type () == NULL */
|| TYPE_FIELD_TYPE (pfn_type, 0)->code () != TYPE_CODE_PTR) || pfn_type->field (0).type ()->code () != TYPE_CODE_PTR)
return; return;
self_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0)); self_type = TYPE_TARGET_TYPE (pfn_type->field (0).type ());
new_type = alloc_type (objfile); new_type = alloc_type (objfile);
smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type), smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type),
pfn_type->fields (), pfn_type->num_fields (), pfn_type->fields (), pfn_type->num_fields (),

View File

@ -300,7 +300,7 @@ evaluate_struct_tuple (struct value *struct_val,
fieldno++; fieldno++;
if (fieldno >= struct_type->num_fields ()) if (fieldno >= struct_type->num_fields ())
error (_("too many initializers")); error (_("too many initializers"));
field_type = TYPE_FIELD_TYPE (struct_type, fieldno); field_type = struct_type->field (fieldno).type ();
if (field_type->code () == TYPE_CODE_UNION if (field_type->code () == TYPE_CODE_UNION
&& TYPE_FIELD_NAME (struct_type, fieldno)[0] == '0') && TYPE_FIELD_NAME (struct_type, fieldno)[0] == '0')
error (_("don't know which variant you want to set")); error (_("don't know which variant you want to set"));
@ -314,7 +314,7 @@ evaluate_struct_tuple (struct value *struct_val,
subfieldno is the index of the actual real (named inner) field subfieldno is the index of the actual real (named inner) field
in substruct_type. */ in substruct_type. */
field_type = TYPE_FIELD_TYPE (struct_type, fieldno); field_type = struct_type->field (fieldno).type ();
if (val == 0) if (val == 0)
val = evaluate_subexp (field_type, exp, pos, noside); val = evaluate_subexp (field_type, exp, pos, noside);
@ -1059,8 +1059,7 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
{ {
for (; tem <= nargs && tem <= type->num_fields (); tem++) for (; tem <= nargs && tem <= type->num_fields (); tem++)
{ {
argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type, argvec[tem] = evaluate_subexp (type->field (tem - 1).type (),
tem - 1),
exp, pos, noside); exp, pos, noside);
} }
} }

View File

@ -273,7 +273,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
fputs_filtered (", ", stream); fputs_filtered (", ", stream);
wrap_here (" "); wrap_here (" ");
} }
f_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0, 0); f_print_type (type->field (i).type (), "", stream, -1, 0, 0);
} }
fprintf_filtered (stream, ")"); fprintf_filtered (stream, ")");
} }
@ -432,12 +432,12 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
fputs_filtered ("\n", stream); fputs_filtered ("\n", stream);
for (index = 0; index < type->num_fields (); index++) for (index = 0; index < type->num_fields (); index++)
{ {
f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, f_type_print_base (type->field (index).type (), stream,
show - 1, level + 4); show - 1, level + 4);
fputs_filtered (" :: ", stream); fputs_filtered (" :: ", stream);
fputs_styled (TYPE_FIELD_NAME (type, index), fputs_styled (TYPE_FIELD_NAME (type, index),
variable_name_style.style (), stream); variable_name_style.style (), stream);
f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index), f_type_print_varspec_suffix (type->field (index).type (),
stream, show - 1, 0, 0, 0, false); stream, show - 1, 0, 0, 0, false);
fputs_filtered ("\n", stream); fputs_filtered ("\n", stream);
} }

View File

@ -317,7 +317,7 @@ f_value_print_innner (struct value *val, struct ui_file *stream, int recurse,
{ {
struct value *field = value_field (val, index); struct value *field = value_field (val, index);
struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, index)); struct type *field_type = check_typedef (type->field (index).type ());
if (field_type->code () != TYPE_CODE_FUNC) if (field_type->code () != TYPE_CODE_FUNC)

View File

@ -1771,7 +1771,7 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
else if (!t_field_name || *t_field_name == '\0') else if (!t_field_name || *t_field_name == '\0')
{ {
struct_elt elt struct_elt elt
= lookup_struct_elt (TYPE_FIELD_TYPE (type, i), name, 1); = lookup_struct_elt (type->field (i).type (), name, 1);
if (elt.field != NULL) if (elt.field != NULL)
{ {
elt.offset += TYPE_FIELD_BITPOS (type, i); elt.offset += TYPE_FIELD_BITPOS (type, i);
@ -2051,7 +2051,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
if (field_is_static (&type->field (i))) if (field_is_static (&type->field (i)))
continue; continue;
/* If the field has dynamic type, then so does TYPE. */ /* If the field has dynamic type, then so does TYPE. */
if (is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0)) if (is_dynamic_type_internal (type->field (i).type (), 0))
return 1; return 1;
/* If the field is at a fixed offset, then it is not /* If the field is at a fixed offset, then it is not
dynamic. */ dynamic. */
@ -2261,7 +2261,7 @@ resolve_dynamic_union (struct type *type,
if (field_is_static (&type->field (i))) if (field_is_static (&type->field (i)))
continue; continue;
t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i), t = resolve_dynamic_type_internal (resolved_type->field (i).type (),
addr_stack, 0); addr_stack, 0);
resolved_type->field (i).set_type (t); resolved_type->field (i).set_type (t);
if (TYPE_LENGTH (t) > max_len) if (TYPE_LENGTH (t) > max_len)
@ -2358,7 +2358,7 @@ compute_variant_fields_inner (struct type *type,
LONGEST bitsize = TYPE_FIELD_BITSIZE (type, idx); LONGEST bitsize = TYPE_FIELD_BITSIZE (type, idx);
LONGEST size = bitsize / 8; LONGEST size = bitsize / 8;
if (size == 0) if (size == 0)
size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, idx)); size = TYPE_LENGTH (type->field (idx).type ());
gdb_byte bits[sizeof (ULONGEST)]; gdb_byte bits[sizeof (ULONGEST)];
read_memory (addr, bits, size); read_memory (addr, bits, size);
@ -2366,7 +2366,7 @@ compute_variant_fields_inner (struct type *type,
LONGEST bitpos = (TYPE_FIELD_BITPOS (type, idx) LONGEST bitpos = (TYPE_FIELD_BITPOS (type, idx)
% TARGET_CHAR_BIT); % TARGET_CHAR_BIT);
discr_value = unpack_bits_as_long (TYPE_FIELD_TYPE (type, idx), discr_value = unpack_bits_as_long (type->field (idx).type (),
bits, bitpos, bitsize); bits, bitpos, bitsize);
} }
} }
@ -2479,7 +2479,7 @@ resolve_dynamic_struct (struct type *type,
{ {
struct dwarf2_property_baton baton; struct dwarf2_property_baton baton;
baton.property_type baton.property_type
= lookup_pointer_type (TYPE_FIELD_TYPE (resolved_type, i)); = lookup_pointer_type (resolved_type->field (i).type ());
baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (resolved_type, i); baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (resolved_type, i);
struct dynamic_prop prop; struct dynamic_prop prop;
@ -2504,7 +2504,7 @@ resolve_dynamic_struct (struct type *type,
error (_("Cannot determine struct field location" error (_("Cannot determine struct field location"
" (invalid location kind)")); " (invalid location kind)"));
pinfo.type = check_typedef (TYPE_FIELD_TYPE (resolved_type, i)); pinfo.type = check_typedef (resolved_type->field (i).type ());
pinfo.valaddr = addr_stack->valaddr; pinfo.valaddr = addr_stack->valaddr;
pinfo.addr pinfo.addr
= (addr_stack->addr = (addr_stack->addr
@ -2512,7 +2512,7 @@ resolve_dynamic_struct (struct type *type,
pinfo.next = addr_stack; pinfo.next = addr_stack;
resolved_type->field (i).set_type resolved_type->field (i).set_type
(resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i), (resolve_dynamic_type_internal (resolved_type->field (i).type (),
&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);
@ -2521,7 +2521,7 @@ resolve_dynamic_struct (struct type *type,
if (TYPE_FIELD_BITSIZE (resolved_type, i) != 0) if (TYPE_FIELD_BITSIZE (resolved_type, i) != 0)
new_bit_length += TYPE_FIELD_BITSIZE (resolved_type, i); new_bit_length += TYPE_FIELD_BITSIZE (resolved_type, i);
else else
new_bit_length += (TYPE_LENGTH (TYPE_FIELD_TYPE (resolved_type, i)) new_bit_length += (TYPE_LENGTH (resolved_type->field (i).type ())
* TARGET_CHAR_BIT); * TARGET_CHAR_BIT);
/* Normally, we would use the position and size of the last field /* Normally, we would use the position and size of the last field
@ -3403,7 +3403,7 @@ type_align (struct type *type)
if (!field_is_static (&type->field (i))) if (!field_is_static (&type->field (i)))
{ {
number_of_non_static_fields++; number_of_non_static_fields++;
ULONGEST f_align = type_align (TYPE_FIELD_TYPE (type, i)); ULONGEST f_align = type_align (type->field (i).type ());
if (f_align == 0) if (f_align == 0)
{ {
/* Don't pretend we know something we don't. */ /* Don't pretend we know something we don't. */
@ -3552,14 +3552,14 @@ is_scalar_type_recursive (struct type *t)
} }
/* Are we dealing with a struct with one element? */ /* Are we dealing with a struct with one element? */
else if (t->code () == TYPE_CODE_STRUCT && t->num_fields () == 1) else if (t->code () == TYPE_CODE_STRUCT && t->num_fields () == 1)
return is_scalar_type_recursive (TYPE_FIELD_TYPE (t, 0)); return is_scalar_type_recursive (t->field (0).type ());
else if (t->code () == TYPE_CODE_UNION) else if (t->code () == TYPE_CODE_UNION)
{ {
int i, n = t->num_fields (); int i, n = t->num_fields ();
/* If all elements of the union are scalar, then the union is scalar. */ /* If all elements of the union are scalar, then the union is scalar. */
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
if (!is_scalar_type_recursive (TYPE_FIELD_TYPE (t, i))) if (!is_scalar_type_recursive (t->field (i).type ()))
return 0; return 0;
return 1; return 1;
@ -3960,7 +3960,7 @@ types_equal (struct type *a, struct type *b)
return false; return false;
for (i = 0; i < a->num_fields (); ++i) for (i = 0; i < a->num_fields (); ++i)
if (!types_equal (TYPE_FIELD_TYPE (a, i), TYPE_FIELD_TYPE (b, i))) if (!types_equal (a->field (i).type (), b->field (i).type ()))
return false; return false;
return true; return true;
@ -4553,8 +4553,8 @@ rank_one_type_parm_set (struct type *parm, struct type *arg, struct value *value
{ {
/* Not in C++ */ /* Not in C++ */
case TYPE_CODE_SET: case TYPE_CODE_SET:
return rank_one_type (TYPE_FIELD_TYPE (parm, 0), return rank_one_type (parm->field (0).type (),
TYPE_FIELD_TYPE (arg, 0), NULL); arg->field (0).type (), NULL);
default: default:
return INCOMPATIBLE_TYPE_BADNESS; return INCOMPATIBLE_TYPE_BADNESS;
} }
@ -5125,16 +5125,16 @@ recursive_dump_type (struct type *type, int spaces)
"[%d] bitpos %s bitsize %d type ", "[%d] bitpos %s bitsize %d type ",
idx, plongest (TYPE_FIELD_BITPOS (type, idx)), idx, plongest (TYPE_FIELD_BITPOS (type, idx)),
TYPE_FIELD_BITSIZE (type, idx)); TYPE_FIELD_BITSIZE (type, idx));
gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout); gdb_print_host_address (type->field (idx).type (), gdb_stdout);
printf_filtered (" name '%s' (", printf_filtered (" name '%s' (",
TYPE_FIELD_NAME (type, idx) != NULL TYPE_FIELD_NAME (type, idx) != NULL
? TYPE_FIELD_NAME (type, idx) ? TYPE_FIELD_NAME (type, idx)
: "<NULL>"); : "<NULL>");
gdb_print_host_address (TYPE_FIELD_NAME (type, idx), gdb_stdout); gdb_print_host_address (TYPE_FIELD_NAME (type, idx), gdb_stdout);
printf_filtered (")\n"); printf_filtered (")\n");
if (TYPE_FIELD_TYPE (type, idx) != NULL) if (type->field (idx).type () != NULL)
{ {
recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4); recursive_dump_type (type->field (idx).type (), spaces + 4);
} }
} }
if (type->code () == TYPE_CODE_RANGE) if (type->code () == TYPE_CODE_RANGE)
@ -5320,9 +5320,9 @@ copy_type_recursive (struct objfile *objfile,
TYPE_FIELD_ARTIFICIAL (new_type, i) = TYPE_FIELD_ARTIFICIAL (new_type, i) =
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 (i).type ())
new_type->field (i).set_type new_type->field (i).set_type
(copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i), (copy_type_recursive (objfile, type->field (i).type (),
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) =

View File

@ -1598,7 +1598,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
#define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn #define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn
#define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list #define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
#define TYPE_BASECLASS(thistype,index) TYPE_FIELD_TYPE(thistype, index) #define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
#define TYPE_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index) #define TYPE_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index)
#define TYPE_BASECLASS_BITPOS(thistype,index) TYPE_FIELD_BITPOS(thistype,index) #define TYPE_BASECLASS_BITPOS(thistype,index) TYPE_FIELD_BITPOS(thistype,index)
@ -1637,7 +1637,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial) #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize) #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
#define TYPE_FIELD_TYPE(thistype, n) ((thistype)->field (n).type ())
#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME((thistype)->field (n)) #define TYPE_FIELD_NAME(thistype, n) FIELD_NAME((thistype)->field (n))
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND ((thistype)->field (n)) #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND ((thistype)->field (n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n)) #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n))

View File

@ -312,7 +312,7 @@ vb_match (struct type *type, int index, struct type *basetype)
/* It's a virtual baseclass pointer, now we just need to find out whether /* It's a virtual baseclass pointer, now we just need to find out whether
it is for this baseclass. */ it is for this baseclass. */
fieldtype = TYPE_FIELD_TYPE (type, index); fieldtype = type->field (index).type ();
if (fieldtype == NULL if (fieldtype == NULL
|| fieldtype->code () != TYPE_CODE_PTR) || fieldtype->code () != TYPE_CODE_PTR)
/* "Can't happen". */ /* "Can't happen". */
@ -362,7 +362,7 @@ gnuv2_baseclass_offset (struct type *type, int index,
int field_length; int field_length;
CORE_ADDR addr; CORE_ADDR addr;
field_type = check_typedef (TYPE_FIELD_TYPE (type, i)); field_type = check_typedef (type->field (i).type ());
field_offset = TYPE_FIELD_BITPOS (type, i) / 8; field_offset = TYPE_FIELD_BITPOS (type, i) / 8;
field_length = TYPE_LENGTH (field_type); field_length = TYPE_LENGTH (field_type);

View File

@ -182,7 +182,7 @@ vtable_ptrdiff_type (struct gdbarch *gdbarch)
= (struct type *) gdbarch_data (gdbarch, vtable_type_gdbarch_data); = (struct type *) gdbarch_data (gdbarch, vtable_type_gdbarch_data);
/* The "offset_to_top" field has the appropriate (ptrdiff_t) type. */ /* The "offset_to_top" field has the appropriate (ptrdiff_t) type. */
return TYPE_FIELD_TYPE (vtable_type, vtable_field_offset_to_top); return vtable_type->field (vtable_field_offset_to_top).type ();
} }
/* Return the offset from the start of the imaginary `struct /* Return the offset from the start of the imaginary `struct
@ -221,7 +221,7 @@ gnuv3_dynamic_class (struct type *type)
for (fieldnum = 0; fieldnum < TYPE_N_BASECLASSES (type); fieldnum++) for (fieldnum = 0; fieldnum < TYPE_N_BASECLASSES (type); fieldnum++)
if (BASETYPE_VIA_VIRTUAL (type, fieldnum) if (BASETYPE_VIA_VIRTUAL (type, fieldnum)
|| gnuv3_dynamic_class (TYPE_FIELD_TYPE (type, fieldnum))) || gnuv3_dynamic_class (type->field (fieldnum).type ()))
{ {
TYPE_CPLUS_DYNAMIC (type) = 1; TYPE_CPLUS_DYNAMIC (type) = 1;
return 1; return 1;
@ -467,7 +467,7 @@ gnuv3_baseclass_offset (struct type *type, int index,
{ {
struct dwarf2_property_baton baton; struct dwarf2_property_baton baton;
baton.property_type baton.property_type
= lookup_pointer_type (TYPE_FIELD_TYPE (type, index)); = lookup_pointer_type (type->field (index).type ());
baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (type, index); baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (type, index);
struct dynamic_prop prop; struct dynamic_prop prop;
@ -550,7 +550,7 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset,
continue; continue;
pos = TYPE_BASECLASS_BITPOS (domain, i) / 8; pos = TYPE_BASECLASS_BITPOS (domain, i) / 8;
basetype = TYPE_FIELD_TYPE (domain, i); basetype = domain->field (i).type ();
/* Recurse with a modified adjustment. We don't need to adjust /* Recurse with a modified adjustment. We don't need to adjust
voffset. */ voffset. */
if (adjustment >= pos && adjustment < pos + TYPE_LENGTH (basetype)) if (adjustment >= pos && adjustment < pos + TYPE_LENGTH (basetype))
@ -1331,7 +1331,7 @@ is_copy_or_move_constructor_type (struct type *class_type,
/* ...and the second argument should be the same as the class /* ...and the second argument should be the same as the class
type, with the expected type code... */ type, with the expected type code... */
struct type *arg_type = TYPE_FIELD_TYPE (method_type, 1); struct type *arg_type = method_type->field (1).type ();
if (arg_type->code () != expected) if (arg_type->code () != expected)
return false; return false;
@ -1345,7 +1345,7 @@ is_copy_or_move_constructor_type (struct type *class_type,
constructor. */ constructor. */
for (int i = 2; i < method_type->num_fields (); i++) for (int i = 2; i < method_type->num_fields (); i++)
{ {
arg_type = TYPE_FIELD_TYPE (method_type, i); arg_type = method_type->field (i).type ();
/* FIXME aktemur/2019-10-31: As of this date, neither /* FIXME aktemur/2019-10-31: As of this date, neither
clang++-7.0.0 nor g++-8.2.0 produce a DW_AT_default_value clang++-7.0.0 nor g++-8.2.0 produce a DW_AT_default_value
attribute. GDB is also not set to read this attribute, yet. attribute. GDB is also not set to read this attribute, yet.
@ -1529,7 +1529,7 @@ gnuv3_pass_by_reference (struct type *type)
for (fieldnum = 0; fieldnum < type->num_fields (); fieldnum++) for (fieldnum = 0; fieldnum < type->num_fields (); fieldnum++)
if (!field_is_static (&type->field (fieldnum))) if (!field_is_static (&type->field (fieldnum)))
{ {
struct type *field_type = TYPE_FIELD_TYPE (type, fieldnum); struct type *field_type = type->field (fieldnum).type ();
/* For arrays, make the decision based on the element type. */ /* For arrays, make the decision based on the element type. */
if (field_type->code () == TYPE_CODE_ARRAY) if (field_type->code () == TYPE_CODE_ARRAY)

View File

@ -75,8 +75,8 @@ gccgo_string_p (struct type *type)
if (type->num_fields () == 2) if (type->num_fields () == 2)
{ {
struct type *type0 = TYPE_FIELD_TYPE (type, 0); struct type *type0 = type->field (0).type ();
struct type *type1 = TYPE_FIELD_TYPE (type, 1); struct type *type1 = type->field (1).type ();
type0 = check_typedef (type0); type0 = check_typedef (type0);
type1 = check_typedef (type1); type1 = check_typedef (type1);

View File

@ -44,7 +44,7 @@ print_go_string (struct type *type,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct gdbarch *gdbarch = get_type_arch (type); struct gdbarch *gdbarch = get_type_arch (type);
struct type *elt_ptr_type = TYPE_FIELD_TYPE (type, 0); struct type *elt_ptr_type = type->field (0).type ();
struct type *elt_type = TYPE_TARGET_TYPE (elt_ptr_type); struct type *elt_type = TYPE_TARGET_TYPE (elt_ptr_type);
LONGEST length; LONGEST length;
/* TODO(dje): The encapsulation of what a pointer is belongs in value.c. /* TODO(dje): The encapsulation of what a pointer is belongs in value.c.

View File

@ -139,7 +139,7 @@ i386_darwin_arg_type_alignment (struct type *type)
for (i = 0; i < type->num_fields (); i++) for (i = 0; i < type->num_fields (); i++)
{ {
int align int align
= i386_darwin_arg_type_alignment (TYPE_FIELD_TYPE (type, i)); = i386_darwin_arg_type_alignment (type->field (i).type ());
res = std::max (res, align); res = std::max (res, align);
} }

View File

@ -2645,7 +2645,7 @@ i386_16_byte_align_p (struct type *type)
int i; int i;
for (i = 0; i < type->num_fields (); i++) for (i = 0; i < type->num_fields (); i++)
{ {
if (i386_16_byte_align_p (TYPE_FIELD_TYPE (type, i))) if (i386_16_byte_align_p (type->field (i).type ()))
return 1; return 1;
} }
} }
@ -2954,7 +2954,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
double' member are returned in %st(0). */ double' member are returned in %st(0). */
if (code == TYPE_CODE_STRUCT && type->num_fields () == 1) if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
{ {
type = check_typedef (TYPE_FIELD_TYPE (type, 0)); type = check_typedef (type->field (0).type ());
if (type->code () == TYPE_CODE_FLT) if (type->code () == TYPE_CODE_FLT)
return (len == 4 || len == 8 || len == 12); return (len == 4 || len == 8 || len == 12);
} }
@ -3022,7 +3022,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
here. */ here. */
if (code == TYPE_CODE_STRUCT && type->num_fields () == 1) if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
{ {
type = check_typedef (TYPE_FIELD_TYPE (type, 0)); type = check_typedef (type->field (0).type ());
return i386_return_value (gdbarch, function, type, regcache, return i386_return_value (gdbarch, function, type, regcache,
readbuf, writebuf); readbuf, writebuf);
} }

View File

@ -221,7 +221,7 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (type->code () == TYPE_CODE_METHOD if (type->code () == TYPE_CODE_METHOD
&& type->num_fields () > 0 && type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0) && TYPE_FIELD_ARTIFICIAL (type, 0)
&& TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR) && type->field (0).type ()->code () == TYPE_CODE_PTR)
thiscall = 1; thiscall = 1;
return i386_thiscall_push_dummy_call (gdbarch, function, regcache, bp_addr, return i386_thiscall_push_dummy_call (gdbarch, function, regcache, bp_addr,

View File

@ -3342,7 +3342,7 @@ is_float_or_hfa_type_recurse (struct type *t, struct type **etp)
for (i = 0; i < t->num_fields (); i++) for (i = 0; i < t->num_fields (); i++)
if (!is_float_or_hfa_type_recurse if (!is_float_or_hfa_type_recurse
(check_typedef (TYPE_FIELD_TYPE (t, i)), etp)) (check_typedef (t->field (i).type ()), etp))
return 0; return 0;
return 1; return 1;
} }
@ -3391,7 +3391,7 @@ slot_alignment_is_next_even (struct type *t)
for (i = 0; i < t->num_fields (); i++) for (i = 0; i < t->num_fields (); i++)
if (slot_alignment_is_next_even if (slot_alignment_is_next_even
(check_typedef (TYPE_FIELD_TYPE (t, i)))) (check_typedef (t->field (i).type ())))
return 1; return 1;
return 0; return 0;
} }

View File

@ -1048,7 +1048,7 @@ call_function_by_hand_dummy (struct value *function,
prototyped = 0; prototyped = 0;
if (i < ftype->num_fields ()) if (i < ftype->num_fields ())
param_type = TYPE_FIELD_TYPE (ftype, i); param_type = ftype->field (i).type ();
else else
param_type = NULL; param_type = NULL;

View File

@ -222,7 +222,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp,
{ {
struct value *temp = arg1; struct value *temp = arg1;
type = TYPE_FIELD_TYPE (type, 1); type = type->field (1).type ();
/* i18n: Do not translate the "_m2_high" part! */ /* i18n: Do not translate the "_m2_high" part! */
arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL, arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL,
_("unbounded structure " _("unbounded structure "
@ -250,7 +250,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp,
if (m2_is_unbounded_array (type)) if (m2_is_unbounded_array (type))
{ {
struct value *temp = arg1; struct value *temp = arg1;
type = TYPE_FIELD_TYPE (type, 0); type = type->field (0).type ();
if (type == NULL || (type->code () != TYPE_CODE_PTR)) if (type == NULL || (type->code () != TYPE_CODE_PTR))
{ {
warning (_("internal error: unbounded " warning (_("internal error: unbounded "

View File

@ -294,7 +294,7 @@ m2_procedure (struct type *type, struct ui_file *stream,
fputs_filtered (", ", stream); fputs_filtered (", ", stream);
wrap_here (" "); wrap_here (" ");
} }
m2_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0, flags); m2_print_type (type->field (i).type (), "", stream, -1, 0, flags);
} }
fprintf_filtered (stream, ") : "); fprintf_filtered (stream, ") : ");
if (TYPE_TARGET_TYPE (type) != NULL) if (TYPE_TARGET_TYPE (type) != NULL)
@ -349,14 +349,14 @@ m2_is_long_set (struct type *type)
len = type->num_fields (); len = type->num_fields ();
for (i = TYPE_N_BASECLASSES (type); i < len; i++) for (i = TYPE_N_BASECLASSES (type); i < len; i++)
{ {
if (TYPE_FIELD_TYPE (type, i) == NULL) if (type->field (i).type () == NULL)
return 0; return 0;
if (TYPE_FIELD_TYPE (type, i)->code () != TYPE_CODE_SET) if (type->field (i).type ()->code () != TYPE_CODE_SET)
return 0; return 0;
if (TYPE_FIELD_NAME (type, i) != NULL if (TYPE_FIELD_NAME (type, i) != NULL
&& (strcmp (TYPE_FIELD_NAME (type, i), "") != 0)) && (strcmp (TYPE_FIELD_NAME (type, i), "") != 0))
return 0; return 0;
range = TYPE_FIELD_TYPE (type, i)->index_type (); range = type->field (i).type ()->index_type ();
if ((i > TYPE_N_BASECLASSES (type)) if ((i > TYPE_N_BASECLASSES (type))
&& previous_high + 1 != TYPE_LOW_BOUND (range)) && previous_high + 1 != TYPE_LOW_BOUND (range))
return 0; return 0;
@ -413,11 +413,11 @@ m2_is_long_set_of_type (struct type *type, struct type **of_type)
i = TYPE_N_BASECLASSES (type); i = TYPE_N_BASECLASSES (type);
if (len == 0) if (len == 0)
return 0; return 0;
range = TYPE_FIELD_TYPE (type, i)->index_type (); range = type->field (i).type ()->index_type ();
target = TYPE_TARGET_TYPE (range); target = TYPE_TARGET_TYPE (range);
l1 = TYPE_LOW_BOUND (TYPE_FIELD_TYPE (type, i)->index_type ()); l1 = TYPE_LOW_BOUND (type->field (i).type ()->index_type ());
h1 = TYPE_HIGH_BOUND (TYPE_FIELD_TYPE (type, len - 1)->index_type ()); h1 = TYPE_HIGH_BOUND (type->field (len - 1).type ()->index_type ());
*of_type = target; *of_type = target;
if (m2_get_discrete_bounds (target, &l2, &h2) >= 0) if (m2_get_discrete_bounds (target, &l2, &h2) >= 0)
return (l1 == l2 && h1 == h2); return (l1 == l2 && h1 == h2);
@ -457,12 +457,12 @@ m2_long_set (struct type *type, struct ui_file *stream, int show, int level,
else else
{ {
fprintf_filtered(stream, "["); fprintf_filtered(stream, "[");
m2_print_bounds (TYPE_FIELD_TYPE (type, i)->index_type (), m2_print_bounds (type->field (i).type ()->index_type (),
stream, show - 1, level, 0); stream, show - 1, level, 0);
fprintf_filtered(stream, ".."); fprintf_filtered(stream, "..");
m2_print_bounds (TYPE_FIELD_TYPE (type, len - 1)->index_type (), m2_print_bounds (type->field (len - 1).type ()->index_type (),
stream, show - 1, level, 1); stream, show - 1, level, 1);
fprintf_filtered(stream, "]"); fprintf_filtered(stream, "]");
} }
@ -496,7 +496,7 @@ m2_is_unbounded_array (struct type *type)
return 0; return 0;
if (strcmp (TYPE_FIELD_NAME (type, 1), "_m2_high") != 0) if (strcmp (TYPE_FIELD_NAME (type, 1), "_m2_high") != 0)
return 0; return 0;
if (TYPE_FIELD_TYPE (type, 0)->code () != TYPE_CODE_PTR) if (type->field (0).type ()->code () != TYPE_CODE_PTR)
return 0; return 0;
return 1; return 1;
} }
@ -517,7 +517,7 @@ m2_unbounded_array (struct type *type, struct ui_file *stream, int show,
if (show > 0) if (show > 0)
{ {
fputs_filtered ("ARRAY OF ", stream); fputs_filtered ("ARRAY OF ", stream);
m2_print_type (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)), m2_print_type (TYPE_TARGET_TYPE (type->field (0).type ()),
"", stream, 0, level, flags); "", stream, 0, level, flags);
} }
return 1; return 1;
@ -566,7 +566,7 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
fputs_styled (TYPE_FIELD_NAME (type, i), fputs_styled (TYPE_FIELD_NAME (type, i),
variable_name_style.style (), stream); variable_name_style.style (), stream);
fputs_filtered (" : ", stream); fputs_filtered (" : ", stream);
m2_print_type (TYPE_FIELD_TYPE (type, i), m2_print_type (type->field (i).type (),
"", "",
stream, 0, level + 4, flags); stream, 0, level + 4, flags);
if (TYPE_FIELD_PACKED (type, i)) if (TYPE_FIELD_PACKED (type, i))

View File

@ -55,8 +55,8 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
i = TYPE_N_BASECLASSES (type); i = TYPE_N_BASECLASSES (type);
if (len == 0) if (len == 0)
return 0; return 0;
*low = TYPE_LOW_BOUND (TYPE_FIELD_TYPE (type, i)->index_type ()); *low = TYPE_LOW_BOUND (type->field (i).type ()->index_type ());
*high = TYPE_HIGH_BOUND (TYPE_FIELD_TYPE (type, len - 1)->index_type ()); *high = TYPE_HIGH_BOUND (type->field (len - 1).type ()->index_type ());
return 1; return 1;
} }
error (_("expecting long_set")); error (_("expecting long_set"));
@ -86,7 +86,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
if (get_long_set_bounds (type, &low_bound, &high_bound)) if (get_long_set_bounds (type, &low_bound, &high_bound))
{ {
field = TYPE_N_BASECLASSES (type); field = TYPE_N_BASECLASSES (type);
range = TYPE_FIELD_TYPE (type, field)->index_type (); range = type->field (field).type ()->index_type ();
} }
else else
{ {
@ -101,7 +101,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
{ {
for (i = low_bound; i <= high_bound; i++) for (i = low_bound; i <= high_bound; i++)
{ {
bitval = value_bit_index (TYPE_FIELD_TYPE (type, field), bitval = value_bit_index (type->field (field).type (),
(TYPE_FIELD_BITPOS (type, field) / 8) + (TYPE_FIELD_BITPOS (type, field) / 8) +
valaddr + embedded_offset, i); valaddr + embedded_offset, i);
if (bitval < 0) if (bitval < 0)
@ -136,7 +136,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
field++; field++;
if (field == len) if (field == len)
break; break;
range = TYPE_FIELD_TYPE (type, field)->index_type (); range = type->field (field).type ()->index_type ();
if (get_discrete_bounds (range, &field_low, &field_high) < 0) if (get_discrete_bounds (range, &field_low, &field_high) < 0)
break; break;
target = TYPE_TARGET_TYPE (range); target = TYPE_TARGET_TYPE (range);
@ -167,11 +167,11 @@ m2_print_unbounded_array (struct value *value,
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value_type (value));
const gdb_byte *valaddr = value_contents_for_printing (value); const gdb_byte *valaddr = value_contents_for_printing (value);
addr = unpack_pointer (TYPE_FIELD_TYPE (type, 0), addr = unpack_pointer (type->field (0).type (),
(TYPE_FIELD_BITPOS (type, 0) / 8) + (TYPE_FIELD_BITPOS (type, 0) / 8) +
valaddr); valaddr);
val = value_at_lazy (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)), val = value_at_lazy (TYPE_TARGET_TYPE (type->field (0).type ()),
addr); addr);
len = unpack_field_as_long (type, valaddr, 1); len = unpack_field_as_long (type, valaddr, 1);

View File

@ -465,7 +465,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
member, we don't bother to check the member's type here. */ member, we don't bother to check the member's type here. */
if (code == TYPE_CODE_STRUCT && type->num_fields () == 1) if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
{ {
type = check_typedef (TYPE_FIELD_TYPE (type, 0)); type = check_typedef (type->field (0).type ());
return m68k_svr4_return_value (gdbarch, function, type, regcache, return m68k_svr4_return_value (gdbarch, function, type, regcache,
readbuf, writebuf); readbuf, writebuf);
} }

View File

@ -4408,7 +4408,7 @@ fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode,
&& (typecode == TYPE_CODE_STRUCT && (typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION) || typecode == TYPE_CODE_UNION)
&& arg_type->num_fields () == 1 && arg_type->num_fields () == 1
&& check_typedef (TYPE_FIELD_TYPE (arg_type, 0))->code () && check_typedef (arg_type->field (0).type ())->code ()
== TYPE_CODE_FLT)) == TYPE_CODE_FLT))
&& MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE); && MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE);
} }
@ -4427,7 +4427,7 @@ mips_type_needs_double_align (struct type *type)
{ {
if (type->num_fields () < 1) if (type->num_fields () < 1)
return 0; return 0;
return mips_type_needs_double_align (TYPE_FIELD_TYPE (type, 0)); return mips_type_needs_double_align (type->field (0).type ());
} }
else if (typecode == TYPE_CODE_UNION) else if (typecode == TYPE_CODE_UNION)
{ {
@ -4435,7 +4435,7 @@ mips_type_needs_double_align (struct type *type)
n = type->num_fields (); n = type->num_fields ();
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
if (mips_type_needs_double_align (TYPE_FIELD_TYPE (type, i))) if (mips_type_needs_double_align (type->field (i).type ()))
return 1; return 1;
return 0; return 0;
} }
@ -4790,7 +4790,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
|| type->code () == TYPE_CODE_UNION) || type->code () == TYPE_CODE_UNION)
&& type->num_fields () == 1) && type->num_fields () == 1)
{ {
struct type *fieldtype = TYPE_FIELD_TYPE (type, 0); struct type *fieldtype = type->field (0).type ();
if (check_typedef (fieldtype)->code () == TYPE_CODE_FLT) if (check_typedef (fieldtype)->code () == TYPE_CODE_FLT)
fp_return_type = 1; fp_return_type = 1;
@ -4865,7 +4865,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
if (pos > offset) if (pos > offset)
return 0; return 0;
field_type = check_typedef (TYPE_FIELD_TYPE (arg_type, i)); field_type = check_typedef (arg_type->field (i).type ());
/* If this field is entirely before the requested offset, go /* If this field is entirely before the requested offset, go
on to the next one. */ on to the next one. */
@ -5229,12 +5229,12 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
&& type->num_fields () <= 2 && type->num_fields () <= 2
&& type->num_fields () >= 1 && type->num_fields () >= 1
&& ((type->num_fields () == 1 && ((type->num_fields () == 1
&& (check_typedef (TYPE_FIELD_TYPE (type, 0))->code () && (check_typedef (type->field (0).type ())->code ()
== TYPE_CODE_FLT)) == TYPE_CODE_FLT))
|| (type->num_fields () == 2 || (type->num_fields () == 2
&& (check_typedef (TYPE_FIELD_TYPE (type, 0))->code () && (check_typedef (type->field (0).type ())->code ()
== TYPE_CODE_FLT) == TYPE_CODE_FLT)
&& (check_typedef (TYPE_FIELD_TYPE (type, 1))->code () && (check_typedef (type->field (1).type ())->code ()
== TYPE_CODE_FLT)))) == TYPE_CODE_FLT))))
{ {
/* A struct that contains one or two floats. Each value is part /* A struct that contains one or two floats. Each value is part
@ -5252,7 +5252,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n",
offset); offset);
if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16) if (TYPE_LENGTH (type->field (field).type ()) == 16)
{ {
/* A 16-byte long double field goes in two consecutive /* A 16-byte long double field goes in two consecutive
registers. */ registers. */
@ -5270,7 +5270,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
else else
mips_xfer_register (gdbarch, regcache, mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + regnum, gdbarch_num_regs (gdbarch) + regnum,
TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)), TYPE_LENGTH (type->field (field).type ()),
gdbarch_byte_order (gdbarch), gdbarch_byte_order (gdbarch),
readbuf, writebuf, offset); readbuf, writebuf, offset);
} }
@ -5782,12 +5782,12 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
&& type->num_fields () <= 2 && type->num_fields () <= 2
&& type->num_fields () >= 1 && type->num_fields () >= 1
&& ((type->num_fields () == 1 && ((type->num_fields () == 1
&& (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) && (TYPE_CODE (type->field (0).type ())
== TYPE_CODE_FLT)) == TYPE_CODE_FLT))
|| (type->num_fields () == 2 || (type->num_fields () == 2
&& (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) && (TYPE_CODE (type->field (0).type ())
== TYPE_CODE_FLT) == TYPE_CODE_FLT)
&& (TYPE_CODE (TYPE_FIELD_TYPE (type, 1)) && (TYPE_CODE (type->field (1).type ())
== TYPE_CODE_FLT))) == TYPE_CODE_FLT)))
&& tdep->mips_fpu_type != MIPS_FPU_NONE) && tdep->mips_fpu_type != MIPS_FPU_NONE)
{ {
@ -5806,7 +5806,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
offset); offset);
mips_xfer_register (gdbarch, regcache, mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + regnum, gdbarch_num_regs (gdbarch) + regnum,
TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)), TYPE_LENGTH (type->field (field).type ()),
gdbarch_byte_order (gdbarch), gdbarch_byte_order (gdbarch),
readbuf, writebuf, offset); readbuf, writebuf, offset);
} }

View File

@ -109,7 +109,7 @@ mn10300_type_align (struct type *type)
case TYPE_CODE_UNION: case TYPE_CODE_UNION:
for (i = 0; i < type->num_fields (); i++) for (i = 0; i < type->num_fields (); i++)
{ {
int falign = mn10300_type_align (TYPE_FIELD_TYPE (type, i)); int falign = mn10300_type_align (type->field (i).type ());
while (align < falign) while (align < falign)
align <<= 1; align <<= 1;
} }
@ -144,7 +144,7 @@ mn10300_use_struct_convention (struct type *type)
/* Structures with a single field are handled as the field /* Structures with a single field are handled as the field
itself. */ itself. */
if (type->num_fields () == 1) if (type->num_fields () == 1)
return mn10300_use_struct_convention (TYPE_FIELD_TYPE (type, 0)); return mn10300_use_struct_convention (type->field (0).type ());
/* Structures with word or double-word size are passed in memory, as /* Structures with word or double-word size are passed in memory, as
long as they require at least word alignment. */ long as they require at least word alignment. */

View File

@ -1408,7 +1408,7 @@ nds32_check_calling_use_fpr (struct type *type)
else if (t->num_fields () != 1) else if (t->num_fields () != 1)
return 0; return 0;
else else
t = TYPE_FIELD_TYPE (t, 0); t = t->field (0).type ();
} }
return typecode == TYPE_CODE_FLT; return typecode == TYPE_CODE_FLT;

View File

@ -316,8 +316,9 @@ exp : exp '['
stringsval.ptr = buf; stringsval.ptr = buf;
stringsval.length = strlen (arrayname); stringsval.length = strlen (arrayname);
strcpy (buf, arrayname); strcpy (buf, arrayname);
current_type = TYPE_FIELD_TYPE (current_type, current_type
arrayfieldindex - 1); = (current_type
->field (arrayfieldindex - 1).type ());
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
write_exp_string (pstate, stringsval); write_exp_string (pstate, stringsval);
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);

View File

@ -113,11 +113,11 @@ is_pascal_string_type (struct type *type,int *length_pos,
if (length_pos) if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT; *length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT;
if (length_size) if (length_size)
*length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)); *length_size = TYPE_LENGTH (type->field (0).type ());
if (string_pos) if (string_pos)
*string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT; *string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
if (char_type) if (char_type)
*char_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 1)); *char_type = TYPE_TARGET_TYPE (type->field (1).type ());
if (arrayname) if (arrayname)
*arrayname = TYPE_FIELD_NAME (type, 1); *arrayname = TYPE_FIELD_NAME (type, 1);
return 2; return 2;
@ -133,13 +133,13 @@ is_pascal_string_type (struct type *type,int *length_pos,
if (length_pos) if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT; *length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
if (length_size) if (length_size)
*length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 1)); *length_size = TYPE_LENGTH (type->field (1).type ());
if (string_pos) if (string_pos)
*string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT; *string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT;
/* FIXME: how can I detect wide chars in GPC ?? */ /* FIXME: how can I detect wide chars in GPC ?? */
if (char_type) if (char_type)
{ {
*char_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 2)); *char_type = TYPE_TARGET_TYPE (type->field (2).type ());
if ((*char_type)->code () == TYPE_CODE_ARRAY) if ((*char_type)->code () == TYPE_CODE_ARRAY)
*char_type = TYPE_TARGET_TYPE (*char_type); *char_type = TYPE_TARGET_TYPE (*char_type);

View File

@ -327,7 +327,7 @@ pascal_print_func_args (struct type *type, struct ui_file *stream,
{ {
fprintf_filtered (stream, "var "); fprintf_filtered (stream, "var ");
} */ } */
pascal_print_type (TYPE_FIELD_TYPE (type, i), "" /* TYPE_FIELD_NAME pascal_print_type (type->field (i).type (), "" /* TYPE_FIELD_NAME
seems invalid! */ seems invalid! */
,stream, -1, 0, flags); ,stream, -1, 0, flags);
} }
@ -620,7 +620,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
print_spaces_filtered (level + 4, stream); print_spaces_filtered (level + 4, stream);
if (field_is_static (&type->field (i))) if (field_is_static (&type->field (i)))
fprintf_filtered (stream, "static "); fprintf_filtered (stream, "static ");
pascal_print_type (TYPE_FIELD_TYPE (type, i), pascal_print_type (type->field (i).type (),
TYPE_FIELD_NAME (type, i), TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 4, flags); stream, show - 1, level + 4, flags);
if (!field_is_static (&type->field (i)) if (!field_is_static (&type->field (i))

View File

@ -305,12 +305,10 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream,
/* Extract the address, assume that it is unsigned. */ /* Extract the address, assume that it is unsigned. */
print_address_demangle print_address_demangle
(options, gdbarch, (options, gdbarch,
extract_unsigned_integer (valaddr extract_unsigned_integer
+ TYPE_FIELD_BITPOS (type, (valaddr + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
VTBL_FNADDR_OFFSET) / 8, TYPE_LENGTH (type->field (VTBL_FNADDR_OFFSET).type ()),
TYPE_LENGTH (TYPE_FIELD_TYPE (type, byte_order),
VTBL_FNADDR_OFFSET)),
byte_order),
stream, demangle); stream, demangle);
} }
else else
@ -580,7 +578,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
wrap_here (n_spaces (2 + 2 * recurse)); wrap_here (n_spaces (2 + 2 * recurse));
} }
annotate_field_begin (TYPE_FIELD_TYPE (type, i)); annotate_field_begin (type->field (i).type ());
if (field_is_static (&type->field (i))) if (field_is_static (&type->field (i)))
{ {

View File

@ -1146,7 +1146,7 @@ ppc64_aggregate_candidate (struct type *type,
continue; continue;
sub_count = ppc64_aggregate_candidate sub_count = ppc64_aggregate_candidate
(TYPE_FIELD_TYPE (type, i), field_type); (type->field (i).type (), field_type);
if (sub_count == -1) if (sub_count == -1)
return -1; return -1;
@ -1498,7 +1498,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
{ {
while (type->code () == TYPE_CODE_STRUCT while (type->code () == TYPE_CODE_STRUCT
&& type->num_fields () == 1) && type->num_fields () == 1)
type = check_typedef (TYPE_FIELD_TYPE (type, 0)); type = check_typedef (type->field (0).type ());
if (type->code () == TYPE_CODE_FLT) if (type->code () == TYPE_CODE_FLT)
ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos); ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);

View File

@ -242,10 +242,10 @@ convert_field (struct type *type, int field)
return NULL; return NULL;
/* A field can have a NULL type in some situations. */ /* A field can have a NULL type in some situations. */
if (TYPE_FIELD_TYPE (type, field) == NULL) if (type->field (field).type () == NULL)
arg = gdbpy_ref<>::new_reference (Py_None); arg = gdbpy_ref<>::new_reference (Py_None);
else else
arg.reset (type_to_type_object (TYPE_FIELD_TYPE (type, field))); arg.reset (type_to_type_object (type->field (field).type ()));
if (arg == NULL) if (arg == NULL)
return NULL; return NULL;
if (PyObject_SetAttrString (result.get (), "type", arg.get ()) < 0) if (PyObject_SetAttrString (result.get (), "type", arg.get ()) < 0)

View File

@ -643,13 +643,13 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
if (regtype->code () == TYPE_CODE_FLT if (regtype->code () == TYPE_CODE_FLT
|| (regtype->code () == TYPE_CODE_UNION || (regtype->code () == TYPE_CODE_UNION
&& regtype->num_fields () == 2 && regtype->num_fields () == 2
&& TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT && regtype->field (0).type ()->code () == TYPE_CODE_FLT
&& TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT) && regtype->field (1).type ()->code () == TYPE_CODE_FLT)
|| (regtype->code () == TYPE_CODE_UNION || (regtype->code () == TYPE_CODE_UNION
&& regtype->num_fields () == 3 && regtype->num_fields () == 3
&& TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT && regtype->field (0).type ()->code () == TYPE_CODE_FLT
&& TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT && regtype->field (1).type ()->code () == TYPE_CODE_FLT
&& TYPE_FIELD_TYPE (regtype, 2)->code () == TYPE_CODE_FLT)) && regtype->field (2).type ()->code () == TYPE_CODE_FLT))
{ {
struct value_print_options opts; struct value_print_options opts;
const gdb_byte *valaddr = value_contents_for_printing (val); const gdb_byte *valaddr = value_contents_for_printing (val);
@ -2052,7 +2052,7 @@ riscv_struct_info::analyse_inner (struct type *type, int offset)
if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_BITPOS) if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_BITPOS)
continue; continue;
struct type *field_type = TYPE_FIELD_TYPE (type, i); struct type *field_type = type->field (i).type ();
field_type = check_typedef (field_type); field_type = check_typedef (field_type);
int field_offset int field_offset
= offset + TYPE_FIELD_BITPOS (type, i) / TARGET_CHAR_BIT; = offset + TYPE_FIELD_BITPOS (type, i) / TARGET_CHAR_BIT;

View File

@ -486,7 +486,7 @@ rust_print_enum (struct value *val, struct ui_file *stream, int recurse,
int variant_fieldno = rust_enum_variant (type); int variant_fieldno = rust_enum_variant (type);
val = value_field (val, variant_fieldno); val = value_field (val, variant_fieldno);
struct type *variant_type = TYPE_FIELD_TYPE (type, variant_fieldno); struct type *variant_type = type->field (variant_fieldno).type ();
int nfields = variant_type->num_fields (); int nfields = variant_type->num_fields ();
@ -775,7 +775,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
styled_string (variable_name_style.style (), styled_string (variable_name_style.style (),
TYPE_FIELD_NAME (type, i))); TYPE_FIELD_NAME (type, i)));
rust_internal_print_type (TYPE_FIELD_TYPE (type, i), NULL, rust_internal_print_type (type->field (i).type (), NULL,
stream, (is_enum ? show : show - 1), stream, (is_enum ? show : show - 1),
level + 2, flags, is_enum, podata); level + 2, flags, is_enum, podata);
if (!for_rust_enum || flags->print_offsets) if (!for_rust_enum || flags->print_offsets)
@ -860,7 +860,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
QUIT; QUIT;
if (i > 0) if (i > 0)
fputs_filtered (", ", stream); fputs_filtered (", ", stream);
rust_internal_print_type (TYPE_FIELD_TYPE (type, i), "", stream, rust_internal_print_type (type->field (i).type (), "", stream,
-1, 0, flags, false, podata); -1, 0, flags, false, podata);
} }
fputs_filtered (")", stream); fputs_filtered (")", stream);
@ -1015,7 +1015,7 @@ rust_composite_type (struct type *original,
if (i > 0) if (i > 0)
TYPE_LENGTH (result) TYPE_LENGTH (result)
= (TYPE_FIELD_BITPOS (result, i - 1) / TARGET_CHAR_BIT + = (TYPE_FIELD_BITPOS (result, i - 1) / TARGET_CHAR_BIT +
TYPE_LENGTH (TYPE_FIELD_TYPE (result, i - 1))); TYPE_LENGTH (result->field (i - 1).type ()));
return result; return result;
} }
@ -1119,7 +1119,7 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
if (fn_type->num_fields () == 0) if (fn_type->num_fields () == 0)
error (_("Function '%s' takes no arguments"), name.c_str ()); error (_("Function '%s' takes no arguments"), name.c_str ());
if (TYPE_FIELD_TYPE (fn_type, 0)->code () == TYPE_CODE_PTR) if (fn_type->field (0).type ()->code () == TYPE_CODE_PTR)
args[0] = value_addr (args[0]); args[0] = value_addr (args[0]);
function = address_of_variable (sym.symbol, block); function = address_of_variable (sym.symbol, block);
@ -1314,7 +1314,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
{ {
if (strcmp (TYPE_FIELD_NAME (type, i), "data_ptr") == 0) if (strcmp (TYPE_FIELD_NAME (type, i), "data_ptr") == 0)
{ {
base_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, i)); base_type = TYPE_TARGET_TYPE (type->field (i).type ());
break; break;
} }
} }

View File

@ -799,7 +799,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
&& i < func_type->num_fields ()) && i < func_type->num_fields ())
{ {
struct type *p_arg_type = struct type *p_arg_type =
TYPE_FIELD_TYPE (func_type, i); func_type->field (i).type ();
p_arg_size = TYPE_LENGTH (p_arg_type); p_arg_size = TYPE_LENGTH (p_arg_type);
} }

View File

@ -480,7 +480,7 @@ score_type_needs_double_align (struct type *type)
n = type->num_fields (); n = type->num_fields ();
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
if (score_type_needs_double_align (TYPE_FIELD_TYPE (type, i))) if (score_type_needs_double_align (type->field (i).type ()))
return 1; return 1;
return 0; return 0;
} }

View File

@ -832,13 +832,13 @@ sh_use_struct_convention (int renesas_abi, struct type *type)
/* If the first field in the aggregate has the same length as the entire /* If the first field in the aggregate has the same length as the entire
aggregate type, the type is returned in registers. */ aggregate type, the type is returned in registers. */
if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == len) if (TYPE_LENGTH (type->field (0).type ()) == len)
return 0; return 0;
/* If the size of the aggregate is 8 bytes and the first field is /* If the size of the aggregate is 8 bytes and the first field is
of size 4 bytes its alignment is equal to long long's alignment, of size 4 bytes its alignment is equal to long long's alignment,
so it's returned in registers. */ so it's returned in registers. */
if (len == 8 && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4) if (len == 8 && TYPE_LENGTH (type->field (0).type ()) == 4)
return 0; return 0;
/* Otherwise use struct convention. */ /* Otherwise use struct convention. */
@ -1050,7 +1050,7 @@ sh_treat_as_flt_p (struct type *type)
return 0; return 0;
/* Otherwise if the type of that member is float, the whole type is /* Otherwise if the type of that member is float, the whole type is
treated as float. */ treated as float. */
if (TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_FLT) if (type->field (0).type ()->code () == TYPE_CODE_FLT)
return 1; return 1;
/* Otherwise it's not treated as float. */ /* Otherwise it's not treated as float. */
return 0; return 0;

View File

@ -1181,7 +1181,7 @@ sparc64_16_byte_align_p (struct type *type)
for (i = 0; i < type->num_fields (); i++) for (i = 0; i < type->num_fields (); i++)
{ {
struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); struct type *subtype = check_typedef (type->field (i).type ());
if (sparc64_16_byte_align_p (subtype)) if (sparc64_16_byte_align_p (subtype))
return 1; return 1;
@ -1258,7 +1258,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
for (i = 0; i < type->num_fields (); i++) for (i = 0; i < type->num_fields (); i++)
{ {
struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); struct type *subtype = check_typedef (type->field (i).type ());
int subpos = bitpos + TYPE_FIELD_BITPOS (type, i); int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
sparc64_store_floating_fields (regcache, subtype, valbuf, sparc64_store_floating_fields (regcache, subtype, valbuf,
@ -1276,7 +1276,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
value in %f1 too (we already have stored in %f0). */ value in %f1 too (we already have stored in %f0). */
if (type->num_fields () == 1) if (type->num_fields () == 1)
{ {
struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, 0)); struct type *subtype = check_typedef (type->field (0).type ());
if (sparc64_floating_p (subtype) && TYPE_LENGTH (subtype) == 4) if (sparc64_floating_p (subtype) && TYPE_LENGTH (subtype) == 4)
regcache->cooked_write (SPARC_F1_REGNUM, valbuf); regcache->cooked_write (SPARC_F1_REGNUM, valbuf);
@ -1346,7 +1346,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
for (i = 0; i < type->num_fields (); i++) for (i = 0; i < type->num_fields (); i++)
{ {
struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); struct type *subtype = check_typedef (type->field (i).type ());
int subpos = bitpos + TYPE_FIELD_BITPOS (type, i); int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos); sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos);

View File

@ -116,7 +116,7 @@ print_offset_data::update (struct type *type, unsigned int field_idx,
return; return;
} }
struct type *ftype = check_typedef (TYPE_FIELD_TYPE (type, field_idx)); struct type *ftype = check_typedef (type->field (field_idx).type ());
if (type->code () == TYPE_CODE_UNION) if (type->code () == TYPE_CODE_UNION)
{ {
/* Since union fields don't have the concept of offsets, we just /* Since union fields don't have the concept of offsets, we just

View File

@ -534,7 +534,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
|| type->code () == TYPE_CODE_UNION) || type->code () == TYPE_CODE_UNION)
&& type->num_fields () == 1) && type->num_fields () == 1)
{ {
fld_type = TYPE_FIELD_TYPE (type, 0); fld_type = type->field (0).type ();
if (v850_type_is_scalar (fld_type) && TYPE_LENGTH (fld_type) >= 4) if (v850_type_is_scalar (fld_type) && TYPE_LENGTH (fld_type) >= 4)
return 0; return 0;
@ -550,12 +550,12 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
and which contains no arrays of more than two elements -> returned in and which contains no arrays of more than two elements -> returned in
register. */ register. */
if (type->code () == TYPE_CODE_STRUCT if (type->code () == TYPE_CODE_STRUCT
&& v850_type_is_scalar (TYPE_FIELD_TYPE (type, 0)) && v850_type_is_scalar (type->field (0).type ())
&& TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4) && TYPE_LENGTH (type->field (0).type ()) == 4)
{ {
for (i = 1; i < type->num_fields (); ++i) for (i = 1; i < type->num_fields (); ++i)
{ {
fld_type = TYPE_FIELD_TYPE (type, 0); fld_type = type->field (0).type ();
if (fld_type->code () == TYPE_CODE_ARRAY) if (fld_type->code () == TYPE_CODE_ARRAY)
{ {
tgt_type = TYPE_TARGET_TYPE (fld_type); tgt_type = TYPE_TARGET_TYPE (fld_type);
@ -574,7 +574,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
{ {
for (i = 0; i < type->num_fields (); ++i) for (i = 0; i < type->num_fields (); ++i)
{ {
fld_type = TYPE_FIELD_TYPE (type, 0); fld_type = type->field (0).type ();
if (!v850_use_struct_convention (gdbarch, fld_type)) if (!v850_use_struct_convention (gdbarch, fld_type))
return 0; return 0;
} }
@ -983,7 +983,7 @@ v850_eight_byte_align_p (struct type *type)
for (i = 0; i < type->num_fields (); i++) for (i = 0; i < type->num_fields (); i++)
{ {
if (v850_eight_byte_align_p (TYPE_FIELD_TYPE (type, i))) if (v850_eight_byte_align_p (type->field (i).type ()))
return 1; return 1;
} }
} }

View File

@ -1824,7 +1824,7 @@ do_search_struct_field (const char *name, struct value *arg1, LONGEST offset,
if (t_field_name if (t_field_name
&& t_field_name[0] == '\0') && t_field_name[0] == '\0')
{ {
struct type *field_type = TYPE_FIELD_TYPE (type, i); struct type *field_type = type->field (i).type ();
if (field_type->code () == TYPE_CODE_UNION if (field_type->code () == TYPE_CODE_UNION
|| field_type->code () == TYPE_CODE_STRUCT) || field_type->code () == TYPE_CODE_STRUCT)
@ -2223,7 +2223,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
{ {
if (!field_is_static (&t->field (i)) if (!field_is_static (&t->field (i))
&& bitpos == TYPE_FIELD_BITPOS (t, i) && bitpos == TYPE_FIELD_BITPOS (t, i)
&& types_equal (ftype, TYPE_FIELD_TYPE (t, i))) && types_equal (ftype, t->field (i).type ()))
return value_primitive_field (*argp, 0, i, t); return value_primitive_field (*argp, 0, i, t);
} }
@ -2968,8 +2968,7 @@ find_oload_champ (gdb::array_view<value *> args,
{ {
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]), : SYMBOL_TYPE (functions[ix])->field (jj).type ());
jj));
parm_types.push_back (t); parm_types.push_back (t);
} }
} }
@ -3206,7 +3205,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
/* Special case: a method taking void. T1 will contain no /* Special case: a method taking void. T1 will contain no
non-artificial fields, and T2 will contain TYPE_CODE_VOID. */ non-artificial fields, and T2 will contain TYPE_CODE_VOID. */
if ((t1->num_fields () - start) == 0 && t2->num_fields () == 1 if ((t1->num_fields () - start) == 0 && t2->num_fields () == 1
&& TYPE_FIELD_TYPE (t2, 0)->code () == TYPE_CODE_VOID) && t2->field (0).type ()->code () == TYPE_CODE_VOID)
return 1; return 1;
if ((t1->num_fields () - start) == t2->num_fields ()) if ((t1->num_fields () - start) == t2->num_fields ())
@ -3215,8 +3214,8 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
for (i = 0; i < t2->num_fields (); ++i) for (i = 0; i < t2->num_fields (); ++i)
{ {
if (compare_ranks (rank_one_type (TYPE_FIELD_TYPE (t1, start + i), if (compare_ranks (rank_one_type (t1->field (start + i).type (),
TYPE_FIELD_TYPE (t2, i), NULL), t2->field (i).type (), NULL),
EXACT_MATCH_BADNESS) != 0) EXACT_MATCH_BADNESS) != 0)
return 0; return 0;
} }
@ -3240,7 +3239,7 @@ get_baseclass_offset (struct type *vt, struct type *cls,
{ {
for (int i = 0; i < TYPE_N_BASECLASSES (vt); i++) for (int i = 0; i < TYPE_N_BASECLASSES (vt); i++)
{ {
struct type *t = TYPE_FIELD_TYPE (vt, i); struct type *t = vt->field (i).type ();
if (types_equal (t, cls)) if (types_equal (t, cls))
{ {
if (BASETYPE_VIA_VIRTUAL (vt, i)) if (BASETYPE_VIA_VIRTUAL (vt, i))
@ -3311,10 +3310,10 @@ value_struct_elt_for_reference (struct type *domain, int offset,
if (want_address) if (want_address)
return value_from_longest return value_from_longest
(lookup_memberptr_type (TYPE_FIELD_TYPE (t, i), domain), (lookup_memberptr_type (t->field (i).type (), domain),
offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3)); offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3));
else if (noside != EVAL_NORMAL) else if (noside != EVAL_NORMAL)
return allocate_value (TYPE_FIELD_TYPE (t, i)); return allocate_value (t->field (i).type ());
else else
{ {
/* Try to evaluate NAME as a qualified name with implicit /* Try to evaluate NAME as a qualified name with implicit

View File

@ -1139,7 +1139,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
{ {
if (TYPE_FIELD_NAME (type, field)[0] != '\0') if (TYPE_FIELD_NAME (type, field)[0] != '\0')
{ {
struct type *field_type = TYPE_FIELD_TYPE (type, field); struct type *field_type = type->field (field).type ();
if (field_type == bool_type if (field_type == bool_type
/* We require boolean types here to be one bit wide. This is a /* We require boolean types here to be one bit wide. This is a

View File

@ -2838,7 +2838,7 @@ value_static_field (struct type *type, int fieldno)
switch (TYPE_FIELD_LOC_KIND (type, fieldno)) switch (TYPE_FIELD_LOC_KIND (type, fieldno))
{ {
case FIELD_LOC_KIND_PHYSADDR: case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), retval = value_at_lazy (type->field (fieldno).type (),
TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)); TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
break; break;
case FIELD_LOC_KIND_PHYSNAME: case FIELD_LOC_KIND_PHYSNAME:
@ -2853,7 +2853,7 @@ value_static_field (struct type *type, int fieldno)
reported as non-debuggable symbols. */ reported as non-debuggable symbols. */
struct bound_minimal_symbol msym struct bound_minimal_symbol msym
= lookup_minimal_symbol (phys_name, NULL, NULL); = lookup_minimal_symbol (phys_name, NULL, NULL);
struct type *field_type = TYPE_FIELD_TYPE (type, fieldno); struct type *field_type = type->field (fieldno).type ();
if (!msym.minsym) if (!msym.minsym)
retval = allocate_optimized_out_value (field_type); retval = allocate_optimized_out_value (field_type);
@ -2906,7 +2906,7 @@ value_primitive_field (struct value *arg1, LONGEST offset,
int unit_size = gdbarch_addressable_memory_unit_size (arch); int unit_size = gdbarch_addressable_memory_unit_size (arch);
arg_type = check_typedef (arg_type); arg_type = check_typedef (arg_type);
type = TYPE_FIELD_TYPE (arg_type, fieldno); type = arg_type->field (fieldno).type ();
/* Call check_typedef on our type to make sure that, if TYPE /* Call check_typedef on our type to make sure that, if TYPE
is a TYPE_CODE_TYPEDEF, its length is set to the length is a TYPE_CODE_TYPEDEF, its length is set to the length
@ -3158,7 +3158,7 @@ unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
{ {
int bitpos = TYPE_FIELD_BITPOS (type, fieldno); int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno); int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
struct type *field_type = TYPE_FIELD_TYPE (type, fieldno); struct type *field_type = type->field (fieldno).type ();
int bit_offset; int bit_offset;
gdb_assert (val != NULL); gdb_assert (val != NULL);
@ -3181,7 +3181,7 @@ unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
{ {
int bitpos = TYPE_FIELD_BITPOS (type, fieldno); int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno); int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
struct type *field_type = TYPE_FIELD_TYPE (type, fieldno); struct type *field_type = type->field (fieldno).type ();
return unpack_bits_as_long (field_type, valaddr, bitpos, bitsize); return unpack_bits_as_long (field_type, valaddr, bitpos, bitsize);
} }
@ -3246,7 +3246,7 @@ value_field_bitfield (struct type *type, int fieldno,
{ {
int bitpos = TYPE_FIELD_BITPOS (type, fieldno); int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno); int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
struct value *res_val = allocate_value (TYPE_FIELD_TYPE (type, fieldno)); struct value *res_val = allocate_value (type->field (fieldno).type ());
unpack_value_bitfield (res_val, bitpos, bitsize, unpack_value_bitfield (res_val, bitpos, bitsize,
valaddr, embedded_offset, val); valaddr, embedded_offset, val);