+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>
* gdbtypes.h (FIELD_TYPE): Remove. Change all call sites
if (field_is_static (&type->field (i)))
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
(member, fundamental_type);
fieldno = ada_get_field_index (type, field_name, 1);
if (fieldno >= 0)
- return TYPE_FIELD_TYPE (type, fieldno);
+ return type->field (fieldno).type ();
subfield_name = field_name;
while (*subfield_name != '\0' && *subfield_name != '.'
if (fieldno < 0)
return NULL;
- type = TYPE_FIELD_TYPE (type, fieldno);
+ type = type->field (fieldno).type ();
field_name = subfield_name;
}
If our INDEX_DESC_TYPE was generated using the older encoding,
the field type should be a meaningless integer type whose name
is not equal to the field name. */
- if (TYPE_FIELD_TYPE (index_desc_type, 0)->name () != NULL
- && strcmp (TYPE_FIELD_TYPE (index_desc_type, 0)->name (),
+ if (index_desc_type->field (0).type ()->name () != NULL
+ && strcmp (index_desc_type->field (0).type ()->name (),
TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
return;
if (TYPE_FIELD_BITSIZE (type, 1) > 0)
return TYPE_FIELD_BITSIZE (type, 1);
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
/* NOTE: The following is bogus; see comment in desc_bounds. */
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))
{
struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1);
if (TYPE_FIELD_BITSIZE (type, 0) > 0)
return TYPE_FIELD_BITSIZE (type, 0);
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 (TYPE_FIELD_BITSIZE (type, 2 * i + which - 2) > 0)
return TYPE_FIELD_BITSIZE (type, 2 * i + which - 2);
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
index_type_desc = ada_find_parallel_type (type, "___XA");
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);
else
index_type = type->index_type ();
}
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);
else
{
{
if (i > 0)
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);
}
fprintf_filtered (stream, ")");
return 0;
else
{
- struct type *ftype = ada_check_typedef (TYPE_FIELD_TYPE (func_type,
- i));
+ struct type *ftype = ada_check_typedef (func_type->field (i).type ());
struct type *atype = ada_check_typedef (value_type (actuals[i]));
if (!ada_type_match (ftype, atype, 1))
modify_field (value_type (descriptor),
value_contents_writeable (descriptor),
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_bitsize (desc_type));
modify_field (value_type (descriptor),
value_contents_writeable (descriptor),
value_pointer (bounds,
- TYPE_FIELD_TYPE (desc_type, 1)),
+ desc_type->field (1).type ()),
fat_pntr_bounds_bitpos (desc_type),
fat_pntr_bounds_bitsize (desc_type));
/* If this is the dispatch table of a tagged type or an interface tag,
then ignore. */
if (ada_is_tagged_type (type, 1)
- && (ada_is_dispatch_table_ptr_type (TYPE_FIELD_TYPE (type, field_num))
- || ada_is_interface_tag (TYPE_FIELD_TYPE (type, field_num))))
+ && (ada_is_dispatch_table_ptr_type (type->field (field_num).type ())
+ || ada_is_interface_tag (type->field (field_num).type ())))
return 1;
/* Not a special field, so it should not be ignored. */
for (i = 0; i < type->num_fields (); i += 1)
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 (parent_type->code () == TYPE_CODE_PTR)
if (!ADA_TYPE_P (type))
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
|| (is_dynamic_field (type, field_num)
struct type *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
relative to its containing structure, but the structure itself is
int bit_size = TYPE_FIELD_BITSIZE (type, i);
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)
*byte_offset_p = fld_offset;
if (bit_offset_p != NULL)
}
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,
bit_size_p, index_p))
return 1;
fixed type?? */
int j;
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)
{
- if (find_struct_field (name, TYPE_FIELD_TYPE (field_type, j),
+ if (find_struct_field (name, field_type->field (j).type (),
fld_offset
+ TYPE_FIELD_BITPOS (field_type, j) / 8,
field_type_p, byte_offset_p,
int bit_pos = TYPE_FIELD_BITPOS (type, parent_offset);
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,
bit_offset_p, bit_size_p, index_p))
return 1;
struct value *v = /* Do not let indent join lines here. */
ada_search_struct_field (name, arg,
offset + TYPE_FIELD_BITPOS (type, i) / 8,
- TYPE_FIELD_TYPE (type, i));
+ type->field (i).type ());
if (v != NULL)
return v;
{
/* PNH: Do we ever get here? See find_struct_field. */
int j;
- struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type,
- i));
+ struct type *field_type = ada_check_typedef (type->field (i).type ());
int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
for (j = 0; j < field_type->num_fields (); j += 1)
break. */
(name, arg,
var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8,
- TYPE_FIELD_TYPE (field_type, j));
+ field_type->field (j).type ());
if (v != NULL)
return v;
{
struct value *v = ada_search_struct_field (
name, arg, offset + TYPE_FIELD_BITPOS (type, parent_offset) / 8,
- TYPE_FIELD_TYPE (type, parent_offset));
+ type->field (parent_offset).type ());
if (v != NULL)
return v;
struct value *v = /* Do not let indent join lines here. */
ada_index_struct_field_1 (index_p, arg,
offset + TYPE_FIELD_BITPOS (type, i) / 8,
- TYPE_FIELD_TYPE (type, i));
+ type->field (i).type ());
if (v != NULL)
return v;
}
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))
{
- 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);
if (t != NULL)
return t;
else if (ada_is_variant_part (type, i))
{
int j;
- struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type,
- i));
+ struct type *field_type = ada_check_typedef (type->field (i).type ());
for (j = field_type->num_fields () - 1; j >= 0; j -= 1)
{
if (v_field_name != NULL
&& field_name_match (v_field_name, name))
- t = TYPE_FIELD_TYPE (field_type, j);
+ t = field_type->field (j).type ();
else
- t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (field_type,
- j),
+ t = ada_lookup_struct_elt_type (field_type->field (j).type (),
name, 0, 1);
if (t != NULL)
{
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);
if (t != NULL)
return t;
const char *name = TYPE_FIELD_NAME (templ_type, field_num);
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;
}
const gdb_byte *field_valaddr = valaddr;
CORE_ADDR field_address = address;
struct type *field_type =
- TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, f));
+ TYPE_TARGET_TYPE (type->field (f).type ());
if (dval0 == NULL)
{
adding overflow recovery code to this already complex code,
we just assume that it's not going to happen. */
fld_bit_len =
- TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, f)) * TARGET_CHAR_BIT;
+ TYPE_LENGTH (rtype->field (f).type ()) * TARGET_CHAR_BIT;
}
else
{
structure, the typedef is the only clue which allows us
to distinguish between the two options. Stripping it
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);
if (TYPE_FIELD_BITSIZE (type, f) > 0)
fld_bit_len =
TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f);
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
the length of our field. If this is a typedef,
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_target (address, off / TARGET_CHAR_BIT), dval);
if (branch_type == NULL)
rtype->field (variant_field).set_type (branch_type);
TYPE_FIELD_NAME (rtype, variant_field) = "S";
fld_bit_len =
- TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, variant_field)) *
+ TYPE_LENGTH (rtype->field (variant_field).type ()) *
TARGET_CHAR_BIT;
if (off + fld_bit_len > bit_len)
bit_len = off + fld_bit_len;
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;
if (is_dynamic_field (type0, f))
TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
branch_type = to_fixed_variant_branch_type
- (TYPE_FIELD_TYPE (type, variant_field),
+ (type->field (variant_field).type (),
cond_offset_host (valaddr,
TYPE_FIELD_BITPOS (type, variant_field)
/ TARGET_CHAR_BIT),
TYPE_FIELD_BITSIZE (rtype, variant_field) = 0;
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);
return rtype;
return empty_record (var_type);
else if (is_dynamic_field (var_type, which))
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);
- else if (variant_field_index (TYPE_FIELD_TYPE (var_type, which)) >= 0)
+ else if (variant_field_index (var_type->field (which).type ()) >= 0)
return
to_fixed_record_type
- (TYPE_FIELD_TYPE (var_type, which), valaddr, address, dval);
+ (var_type->field (which).type (), valaddr, address, dval);
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
for (i = 0; i < desc_type->num_fields (); i++)
{
if (!ada_is_redundant_range_encoding (this_layer->index_type (),
- TYPE_FIELD_TYPE (desc_type, i)))
+ desc_type->field (i).type ()))
return 0;
this_layer = check_typedef (TYPE_TARGET_TYPE (this_layer));
}
for (i = index_type_desc->num_fields () - 1; i >= 0; i -= 1)
{
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, range_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)
type1->set_name (ada_type_name (type));
|| real_type_namer->num_fields () != 1)
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
looked up by name. We prefer the newer encoding because it is
}
/* 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. */
ada_aligned_type (struct 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
return ada_get_base_type (type);
}
ada_aligned_value_addr (struct type *type, const gdb_byte *valaddr)
{
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 +
TYPE_FIELD_BITPOS (type,
0) / TARGET_CHAR_BIT);
array_fieldno = ada_get_field_index (type, "P_ARRAY", 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)
bounds_type = TYPE_TARGET_TYPE (bounds_type);
if (bounds_type->code () != TYPE_CODE_STRUCT)
{
if (k > 0)
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 */);
if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
struct type *var_type, *par_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);
if (var_type->code () == TYPE_CODE_PTR)
fprintf_filtered (stream, "\n%*swhen ", level + 4, "");
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,
flags)
<= 0)
const struct type_print_options *flags)
{
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')
variant = "?";
if (ada_is_parent_field (type, i) || ada_is_ignored_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);
else if (ada_is_variant_part (type, i))
{
{
flds += 1;
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),
stream, show - 1, level + 4, flags);
fprintf_filtered (stream, ";");
else
{
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%*swhen ? =>\n%*s", level + 8, "",
level + 12, "");
- ada_print_type (TYPE_FIELD_TYPE (type, i),
+ ada_print_type (type->field (i).type (),
TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 12, flags);
fprintf_filtered (stream, ";");
wrap_here (" ");
}
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);
}
fprintf_filtered (stream, ")");
const struct language_defn *language)
{
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);
if (which < 0)
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",
ada_name_prefix_len (TYPE_FIELD_NAME (type, i)),
TYPE_FIELD_NAME (type, i));
int bit_size = TYPE_FIELD_BITSIZE (type, i);
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
(value, nullptr,
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.deref_ref = 0;
common_val_print (v, stream, recurse + 1, &opts, language);
type = value_type (value);
}
else
- type = TYPE_FIELD_TYPE (parent_type, fieldno);
+ type = parent_type->field (fieldno).type ();
if (child_value)
*child_value = value;
{
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 align = type_align(subtype);
enum amd64_reg_class theclass[2],
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 pos = bitpos / 64;
enum amd64_reg_class subclass[2];
int sub_count = 0;
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);
if (sub_count == -1)
return -1;
int 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);
if (sub_count == -1)
return -1;
enum 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? */
if (field_type_code == TYPE_CODE_FLT)
{
/* Is this a bitfield? */
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
+ TYPE_FIELD_BITPOS (type, fieldno)),
(offset * TARGET_CHAR_BIT
gen_offset (ax, offset
+ TYPE_FIELD_BITPOS (type, fieldno) / TARGET_CHAR_BIT);
value->kind = axs_lvalue_memory;
- value->type = TYPE_FIELD_TYPE (type, fieldno);
+ value->type = type->field (fieldno).type ();
}
}
{
ax_const_l (ax, TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
value->kind = axs_lvalue_memory;
- value->type = TYPE_FIELD_TYPE (type, fieldno);
+ value->type = type->field (fieldno).type ();
value->optimized_out = 0;
}
else
/* If we know the size of the array, we can use it as a limit on
the number of characters to be fetched. */
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;
- get_discrete_bounds (TYPE_FIELD_TYPE (type, 0),
+ get_discrete_bounds (type->field (0).type (),
&low_bound, &high_bound);
fetchlimit = high_bound - low_bound + 1;
}
wrap_here (" ");
}
- param_type = TYPE_FIELD_TYPE (type, i);
+ param_type = type->field (i).type ();
if (language == language_cplus && linkage_name)
{
int newshow = show - 1;
if (!is_static && flags->print_offsets
- && (TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_STRUCT
- || TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_UNION))
+ && (type->field (i).type ()->code () == TYPE_CODE_STRUCT
+ || type->field (i).type ()->code () == TYPE_CODE_UNION))
{
/* If we're printing offsets and this field's type is
either a struct or an union, then we're interested in
the whole struct/union. */
local_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),
stream, newshow, level + 4,
language, &local_flags, &local_podata);
print_spaces_filtered (level + 4, stream);
/* We pass "show" here and not "show - 1" to get enum types
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),
stream, show, level + 4,
language, &local_flags, podata);
TYPE_CODE_PTR.) */
struct gdbarch *gdbarch = get_type_arch (type);
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);
CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);
{
if (cname)
{
- if (TYPE_FIELD_TYPE (type, index)->code ()
+ if (type->field (index).type ()->code ()
== TYPE_CODE_STRUCT)
*cname = ANONYMOUS_STRUCT_NAME;
else
}
if (ctype)
- *ctype = TYPE_FIELD_TYPE (type, index);
+ *ctype = type->field (index).type ();
}
break;
{
if (cname)
{
- if (TYPE_FIELD_TYPE (type, type_index)->code ()
+ if (type->field (type_index).type ()->code ()
== TYPE_CODE_STRUCT)
*cname = ANONYMOUS_STRUCT_NAME;
- else if (TYPE_FIELD_TYPE (type, type_index)->code ()
+ else if (type->field (type_index).type ()->code ()
== TYPE_CODE_UNION)
*cname = ANONYMOUS_UNION_NAME;
}
*cvalue = value_struct_element_index (value, type_index);
if (ctype)
- *ctype = TYPE_FIELD_TYPE (type, type_index);
+ *ctype = type->field (type_index).type ();
}
else if (index < TYPE_N_BASECLASSES (type))
{
*cname = TYPE_FIELD_NAME (type, index);
if (cvalue && value)
- *cvalue = value_cast (TYPE_FIELD_TYPE (type, index), value);
+ *cvalue = value_cast (type->field (index).type (), value);
if (ctype)
{
- *ctype = TYPE_FIELD_TYPE (type, index);
+ *ctype = type->field (index).type ();
}
if (cfull_expression)
for (i = 0; i < type->num_fields (); ++i)
if (!field_is_static (&type->field (i)))
generate_vla_size (compiler, stream, gdbarch, registers_used, pc,
- TYPE_FIELD_TYPE (type, i), sym);
+ type->field (i).type (), sym);
}
break;
}
gcc_type field_type;
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)
- bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (type, i));
+ bitsize = 8 * TYPE_LENGTH (type->field (i).type ());
context->plugin ().build_add_field (result,
TYPE_FIELD_NAME (type, i),
field_type,
array.n_elements = type->num_fields ();
array.elements = XNEWVEC (gcc_type, type->num_fields ());
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,
&array, is_varargs);
field_name = nullptr;
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)))
{
| get_field_access_flag (type, i);
if (bitsize == 0)
- bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (type, i));
+ bitsize = 8 * TYPE_LENGTH (type->field (i).type ());
instance->plugin ().build_field
(field_name, field_type, field_flags, bitsize,
else
{
array.elements[i - artificials]
- = instance->convert_type (TYPE_FIELD_TYPE (type, i));
+ = instance->convert_type (type->field (i).type ());
}
}
if (func_type->num_fields () == 0)
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)
error (_("Invalid type code %d of first parameter of function \"%s\" "
"in compiled module \"%s\"."),
ULONGEST reg_bitpos = TYPE_FIELD_BITPOS (regs_type, fieldno);
ULONGEST reg_bitsize = TYPE_FIELD_BITSIZE (regs_type, fieldno);
ULONGEST reg_offset;
- struct type *reg_type = check_typedef (TYPE_FIELD_TYPE (regs_type,
- fieldno));
+ struct type *reg_type
+ = check_typedef (regs_type->field (fieldno).type ());
ULONGEST reg_size = TYPE_LENGTH (reg_type);
int regnum;
struct value *regval;
{
gdb_assert (regs_addr != 0);
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;
}
if (func_type->num_fields () >= 2)
{
gdb_assert (data->out_value_addr != 0);
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;
}
gdb_assert (current_arg == func_type->num_fields ());
fieldname, namelen))
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. */
- add_struct_fields (TYPE_FIELD_TYPE (type, i),
+ add_struct_fields (type->field (i).type (),
output, fieldname, namelen);
}
}
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)))
{
{
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,
opts);
}
else if (i == vptr_fieldno && type == vptr_basetype)
{
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))
{
for (i = 0; i < TYPE_N_BASECLASSES (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)
{
- *self_p = TYPE_FIELD_TYPE (self, i);
+ *self_p = self->field (i).type ();
cp_find_class_member (self_p, fieldno, offset - bitpos);
return;
}
const struct value_print_options *options)
{
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, 1), "ptr") == 0
&& !value_bits_any_optimized_out (val,
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));
addr = unpack_pointer (ptr_type,
valaddr + TYPE_FIELD_BITPOS (type, 1) / 8
variant_part *part = new (obstack) variant_part;
part->discriminant_index = discriminant_index;
- part->is_unsigned = TYPE_UNSIGNED (TYPE_FIELD_TYPE (type,
- discriminant_index));
+ part->is_unsigned = TYPE_UNSIGNED (type->field (discriminant_index).type ());
part->variants = gdb::array_view<variant> (variants, n_variants);
void *storage = obstack_alloc (obstack, sizeof (gdb::array_view<variant_part>));
/* Decode the field name to find the offset of the
discriminant. */
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')
{
char *tail;
++name;
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
field at index 1 and the data-less field at index 2. */
type->field (1) = saved_field;
TYPE_FIELD_NAME (type, 1)
- = rust_last_path_segment (TYPE_FIELD_TYPE (type, 1)->name ());
- TYPE_FIELD_TYPE (type, 1)->set_name
+ = rust_last_path_segment (type->field (1).type ()->name ());
+ type->field (1).type ()->set_name
(rust_fully_qualify (&objfile->objfile_obstack, type->name (),
TYPE_FIELD_NAME (type, 1)));
because the type has already been recorded. */
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
= rust_last_path_segment (field_type->name ());
TYPE_FIELD_NAME (type, 0) = variant_name;
struct type *disr_type = nullptr;
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)
{
That name can be used to look up the correct
discriminant. */
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);
if (iter != discriminant_map.end ())
}
/* 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)
{
sub_type->set_num_fields (sub_type->num_fields () - 1);
the two cases. */
if (type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0)
- && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR
- && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type,
- 0))))
+ && type->field (0).type ()->code () == TYPE_CODE_PTR
+ && TYPE_CONST (TYPE_TARGET_TYPE (type->field (0).type ())))
buf.puts (" const");
}
}
else
{
fnp->fcontext
- = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (this_type, 0));
+ = TYPE_TARGET_TYPE (this_type->field (0).type ());
}
}
}
return;
/* Find the type of the method. */
- pfn_type = TYPE_FIELD_TYPE (type, 0);
+ pfn_type = type->field (0).type ();
if (pfn_type == NULL
|| pfn_type->code () != TYPE_CODE_PTR
|| TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC)
/* Look for the "this" argument. */
pfn_type = TYPE_TARGET_TYPE (pfn_type);
if (pfn_type->num_fields () == 0
- /* || TYPE_FIELD_TYPE (pfn_type, 0) == NULL */
- || TYPE_FIELD_TYPE (pfn_type, 0)->code () != TYPE_CODE_PTR)
+ /* || pfn_type->field (0).type () == NULL */
+ || pfn_type->field (0).type ()->code () != TYPE_CODE_PTR)
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);
smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type),
pfn_type->fields (), pfn_type->num_fields (),
fieldno++;
if (fieldno >= struct_type->num_fields ())
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
&& TYPE_FIELD_NAME (struct_type, fieldno)[0] == '0')
error (_("don't know which variant you want to set"));
subfieldno is the index of the actual real (named inner) field
in substruct_type. */
- field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
+ field_type = struct_type->field (fieldno).type ();
if (val == 0)
val = evaluate_subexp (field_type, exp, pos, noside);
{
for (; tem <= nargs && tem <= type->num_fields (); tem++)
{
- argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type,
- tem - 1),
+ argvec[tem] = evaluate_subexp (type->field (tem - 1).type (),
exp, pos, noside);
}
}
fputs_filtered (", ", stream);
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, ")");
}
fputs_filtered ("\n", stream);
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);
fputs_filtered (" :: ", stream);
fputs_styled (TYPE_FIELD_NAME (type, index),
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);
fputs_filtered ("\n", stream);
}
{
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)
else if (!t_field_name || *t_field_name == '\0')
{
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)
{
elt.offset += TYPE_FIELD_BITPOS (type, i);
if (field_is_static (&type->field (i)))
continue;
/* 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;
/* If the field is at a fixed offset, then it is not
dynamic. */
if (field_is_static (&type->field (i)))
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);
resolved_type->field (i).set_type (t);
if (TYPE_LENGTH (t) > max_len)
LONGEST bitsize = TYPE_FIELD_BITSIZE (type, idx);
LONGEST size = bitsize / 8;
if (size == 0)
- size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, idx));
+ size = TYPE_LENGTH (type->field (idx).type ());
gdb_byte bits[sizeof (ULONGEST)];
read_memory (addr, bits, size);
LONGEST bitpos = (TYPE_FIELD_BITPOS (type, idx)
% 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);
}
}
{
struct dwarf2_property_baton baton;
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);
struct dynamic_prop prop;
error (_("Cannot determine struct field location"
" (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.addr
= (addr_stack->addr
pinfo.next = addr_stack;
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));
gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
== FIELD_LOC_KIND_BITPOS);
if (TYPE_FIELD_BITSIZE (resolved_type, i) != 0)
new_bit_length += TYPE_FIELD_BITSIZE (resolved_type, i);
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);
/* Normally, we would use the position and size of the last field
if (!field_is_static (&type->field (i)))
{
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)
{
/* Don't pretend we know something we don't. */
}
/* Are we dealing with a struct with one element? */
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)
{
int i, n = t->num_fields ();
/* If all elements of the union are scalar, then the union is scalar. */
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 1;
return false;
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 true;
{
/* Not in C++ */
case TYPE_CODE_SET:
- return rank_one_type (TYPE_FIELD_TYPE (parm, 0),
- TYPE_FIELD_TYPE (arg, 0), NULL);
+ return rank_one_type (parm->field (0).type (),
+ arg->field (0).type (), NULL);
default:
return INCOMPATIBLE_TYPE_BADNESS;
}
"[%d] bitpos %s bitsize %d type ",
idx, plongest (TYPE_FIELD_BITPOS (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' (",
TYPE_FIELD_NAME (type, idx) != NULL
? TYPE_FIELD_NAME (type, idx)
: "<NULL>");
gdb_print_host_address (TYPE_FIELD_NAME (type, idx), gdb_stdout);
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)
TYPE_FIELD_ARTIFICIAL (new_type, i) =
TYPE_FIELD_ARTIFICIAL (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
- (copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
+ (copy_type_recursive (objfile, type->field (i).type (),
copied_types));
if (TYPE_FIELD_NAME (type, i))
TYPE_FIELD_NAME (new_type, i) =
#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_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_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index)
#define TYPE_BASECLASS_BITPOS(thistype,index) TYPE_FIELD_BITPOS(thistype,index)
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
#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_LOC_KIND(thistype, n) FIELD_LOC_KIND ((thistype)->field (n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n))
/* It's a virtual baseclass pointer, now we just need to find out whether
it is for this baseclass. */
- fieldtype = TYPE_FIELD_TYPE (type, index);
+ fieldtype = type->field (index).type ();
if (fieldtype == NULL
|| fieldtype->code () != TYPE_CODE_PTR)
/* "Can't happen". */
int field_length;
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_length = TYPE_LENGTH (field_type);
= (struct type *) gdbarch_data (gdbarch, vtable_type_gdbarch_data);
/* 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
for (fieldnum = 0; fieldnum < TYPE_N_BASECLASSES (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;
return 1;
{
struct dwarf2_property_baton baton;
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);
struct dynamic_prop prop;
continue;
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
voffset. */
if (adjustment >= pos && adjustment < pos + TYPE_LENGTH (basetype))
/* ...and the second argument should be the same as the class
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)
return false;
constructor. */
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
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.
for (fieldnum = 0; fieldnum < type->num_fields (); 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. */
if (field_type->code () == TYPE_CODE_ARRAY)
if (type->num_fields () == 2)
{
- struct type *type0 = TYPE_FIELD_TYPE (type, 0);
- struct type *type1 = TYPE_FIELD_TYPE (type, 1);
+ struct type *type0 = type->field (0).type ();
+ struct type *type1 = type->field (1).type ();
type0 = check_typedef (type0);
type1 = check_typedef (type1);
const struct value_print_options *options)
{
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);
LONGEST length;
/* TODO(dje): The encapsulation of what a pointer is belongs in value.c.
for (i = 0; i < type->num_fields (); i++)
{
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);
}
int 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;
}
}
double' member are returned in %st(0). */
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)
return (len == 4 || len == 8 || len == 12);
}
here. */
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,
readbuf, writebuf);
}
if (type->code () == TYPE_CODE_METHOD
&& type->num_fields () > 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;
return i386_thiscall_push_dummy_call (gdbarch, function, regcache, bp_addr,
for (i = 0; i < t->num_fields (); i++)
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 1;
}
for (i = 0; i < t->num_fields (); i++)
if (slot_alignment_is_next_even
- (check_typedef (TYPE_FIELD_TYPE (t, i))))
+ (check_typedef (t->field (i).type ())))
return 1;
return 0;
}
prototyped = 0;
if (i < ftype->num_fields ())
- param_type = TYPE_FIELD_TYPE (ftype, i);
+ param_type = ftype->field (i).type ();
else
param_type = NULL;
{
struct value *temp = arg1;
- type = TYPE_FIELD_TYPE (type, 1);
+ type = type->field (1).type ();
/* i18n: Do not translate the "_m2_high" part! */
arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL,
_("unbounded structure "
if (m2_is_unbounded_array (type))
{
struct value *temp = arg1;
- type = TYPE_FIELD_TYPE (type, 0);
+ type = type->field (0).type ();
if (type == NULL || (type->code () != TYPE_CODE_PTR))
{
warning (_("internal error: unbounded "
fputs_filtered (", ", stream);
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, ") : ");
if (TYPE_TARGET_TYPE (type) != NULL)
len = type->num_fields ();
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
{
- if (TYPE_FIELD_TYPE (type, i) == NULL)
+ if (type->field (i).type () == NULL)
return 0;
- if (TYPE_FIELD_TYPE (type, i)->code () != TYPE_CODE_SET)
+ if (type->field (i).type ()->code () != TYPE_CODE_SET)
return 0;
if (TYPE_FIELD_NAME (type, i) != NULL
&& (strcmp (TYPE_FIELD_NAME (type, i), "") != 0))
return 0;
- range = TYPE_FIELD_TYPE (type, i)->index_type ();
+ range = type->field (i).type ()->index_type ();
if ((i > TYPE_N_BASECLASSES (type))
&& previous_high + 1 != TYPE_LOW_BOUND (range))
return 0;
i = TYPE_N_BASECLASSES (type);
if (len == 0)
return 0;
- range = TYPE_FIELD_TYPE (type, i)->index_type ();
+ range = type->field (i).type ()->index_type ();
target = TYPE_TARGET_TYPE (range);
- l1 = TYPE_LOW_BOUND (TYPE_FIELD_TYPE (type, i)->index_type ());
- h1 = TYPE_HIGH_BOUND (TYPE_FIELD_TYPE (type, len - 1)->index_type ());
+ l1 = TYPE_LOW_BOUND (type->field (i).type ()->index_type ());
+ h1 = TYPE_HIGH_BOUND (type->field (len - 1).type ()->index_type ());
*of_type = target;
if (m2_get_discrete_bounds (target, &l2, &h2) >= 0)
return (l1 == l2 && h1 == h2);
else
{
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);
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);
fprintf_filtered(stream, "]");
}
return 0;
if (strcmp (TYPE_FIELD_NAME (type, 1), "_m2_high") != 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 1;
}
if (show > 0)
{
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);
}
return 1;
fputs_styled (TYPE_FIELD_NAME (type, i),
variable_name_style.style (), stream);
fputs_filtered (" : ", stream);
- m2_print_type (TYPE_FIELD_TYPE (type, i),
+ m2_print_type (type->field (i).type (),
"",
stream, 0, level + 4, flags);
if (TYPE_FIELD_PACKED (type, i))
i = TYPE_N_BASECLASSES (type);
if (len == 0)
return 0;
- *low = TYPE_LOW_BOUND (TYPE_FIELD_TYPE (type, i)->index_type ());
- *high = TYPE_HIGH_BOUND (TYPE_FIELD_TYPE (type, len - 1)->index_type ());
+ *low = TYPE_LOW_BOUND (type->field (i).type ()->index_type ());
+ *high = TYPE_HIGH_BOUND (type->field (len - 1).type ()->index_type ());
return 1;
}
error (_("expecting long_set"));
if (get_long_set_bounds (type, &low_bound, &high_bound))
{
field = TYPE_N_BASECLASSES (type);
- range = TYPE_FIELD_TYPE (type, field)->index_type ();
+ range = type->field (field).type ()->index_type ();
}
else
{
{
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) +
valaddr + embedded_offset, i);
if (bitval < 0)
field++;
if (field == len)
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)
break;
target = TYPE_TARGET_TYPE (range);
struct type *type = check_typedef (value_type (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) +
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);
len = unpack_field_as_long (type, valaddr, 1);
member, we don't bother to check the member's type here. */
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,
readbuf, writebuf);
}
&& (typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION)
&& 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))
&& MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE);
}
{
if (type->num_fields () < 1)
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)
{
n = type->num_fields ();
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 0;
}
|| type->code () == TYPE_CODE_UNION)
&& 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)
fp_return_type = 1;
if (pos > offset)
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
on to the next one. */
&& type->num_fields () <= 2
&& 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->num_fields () == 2
- && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code ()
+ && (check_typedef (type->field (0).type ())->code ()
== TYPE_CODE_FLT)
- && (check_typedef (TYPE_FIELD_TYPE (type, 1))->code ()
+ && (check_typedef (type->field (1).type ())->code ()
== TYPE_CODE_FLT))))
{
/* A struct that contains one or two floats. Each value is part
if (mips_debug)
fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n",
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
registers. */
else
mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + regnum,
- TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
+ TYPE_LENGTH (type->field (field).type ()),
gdbarch_byte_order (gdbarch),
readbuf, writebuf, offset);
}
&& type->num_fields () <= 2
&& 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->num_fields () == 2
- && (TYPE_CODE (TYPE_FIELD_TYPE (type, 0))
+ && (TYPE_CODE (type->field (0).type ())
== TYPE_CODE_FLT)
- && (TYPE_CODE (TYPE_FIELD_TYPE (type, 1))
+ && (TYPE_CODE (type->field (1).type ())
== TYPE_CODE_FLT)))
&& tdep->mips_fpu_type != MIPS_FPU_NONE)
{
offset);
mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + regnum,
- TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)),
+ TYPE_LENGTH (type->field (field).type ()),
gdbarch_byte_order (gdbarch),
readbuf, writebuf, offset);
}
case TYPE_CODE_UNION:
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)
align <<= 1;
}
/* Structures with a single field are handled as the field
itself. */
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
long as they require at least word alignment. */
else if (t->num_fields () != 1)
return 0;
else
- t = TYPE_FIELD_TYPE (t, 0);
+ t = t->field (0).type ();
}
return typecode == TYPE_CODE_FLT;
stringsval.ptr = buf;
stringsval.length = strlen (arrayname);
strcpy (buf, arrayname);
- current_type = TYPE_FIELD_TYPE (current_type,
- arrayfieldindex - 1);
+ current_type
+ = (current_type
+ ->field (arrayfieldindex - 1).type ());
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
write_exp_string (pstate, stringsval);
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT;
if (length_size)
- *length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0));
+ *length_size = TYPE_LENGTH (type->field (0).type ());
if (string_pos)
*string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
if (char_type)
- *char_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 1));
+ *char_type = TYPE_TARGET_TYPE (type->field (1).type ());
if (arrayname)
*arrayname = TYPE_FIELD_NAME (type, 1);
return 2;
if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
if (length_size)
- *length_size = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 1));
+ *length_size = TYPE_LENGTH (type->field (1).type ());
if (string_pos)
*string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT;
/* FIXME: how can I detect wide chars in GPC ?? */
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)
*char_type = TYPE_TARGET_TYPE (*char_type);
{
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! */
,stream, -1, 0, flags);
}
print_spaces_filtered (level + 4, stream);
if (field_is_static (&type->field (i)))
fprintf_filtered (stream, "static ");
- pascal_print_type (TYPE_FIELD_TYPE (type, i),
+ pascal_print_type (type->field (i).type (),
TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 4, flags);
if (!field_is_static (&type->field (i))
/* Extract the address, assume that it is unsigned. */
print_address_demangle
(options, gdbarch,
- extract_unsigned_integer (valaddr
- + TYPE_FIELD_BITPOS (type,
- VTBL_FNADDR_OFFSET) / 8,
- TYPE_LENGTH (TYPE_FIELD_TYPE (type,
- VTBL_FNADDR_OFFSET)),
- byte_order),
+ extract_unsigned_integer
+ (valaddr + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
+ TYPE_LENGTH (type->field (VTBL_FNADDR_OFFSET).type ()),
+ byte_order),
stream, demangle);
}
else
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)))
{
continue;
sub_count = ppc64_aggregate_candidate
- (TYPE_FIELD_TYPE (type, i), field_type);
+ (type->field (i).type (), field_type);
if (sub_count == -1)
return -1;
{
while (type->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)
ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);
return NULL;
/* 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);
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)
return NULL;
if (PyObject_SetAttrString (result.get (), "type", arg.get ()) < 0)
if (regtype->code () == TYPE_CODE_FLT
|| (regtype->code () == TYPE_CODE_UNION
&& regtype->num_fields () == 2
- && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT
- && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT)
+ && regtype->field (0).type ()->code () == TYPE_CODE_FLT
+ && regtype->field (1).type ()->code () == TYPE_CODE_FLT)
|| (regtype->code () == TYPE_CODE_UNION
&& regtype->num_fields () == 3
- && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT
- && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT
- && TYPE_FIELD_TYPE (regtype, 2)->code () == TYPE_CODE_FLT))
+ && regtype->field (0).type ()->code () == TYPE_CODE_FLT
+ && regtype->field (1).type ()->code () == TYPE_CODE_FLT
+ && regtype->field (2).type ()->code () == TYPE_CODE_FLT))
{
struct value_print_options opts;
const gdb_byte *valaddr = value_contents_for_printing (val);
if (TYPE_FIELD_LOC_KIND (type, i) != FIELD_LOC_KIND_BITPOS)
continue;
- struct type *field_type = TYPE_FIELD_TYPE (type, i);
+ struct type *field_type = type->field (i).type ();
field_type = check_typedef (field_type);
int field_offset
= offset + TYPE_FIELD_BITPOS (type, i) / TARGET_CHAR_BIT;
int variant_fieldno = rust_enum_variant (type);
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 ();
styled_string (variable_name_style.style (),
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),
level + 2, flags, is_enum, podata);
if (!for_rust_enum || flags->print_offsets)
QUIT;
if (i > 0)
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);
}
fputs_filtered (")", stream);
if (i > 0)
TYPE_LENGTH (result)
= (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;
}
if (fn_type->num_fields () == 0)
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]);
function = address_of_variable (sym.symbol, block);
{
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;
}
}
&& i < func_type->num_fields ())
{
struct type *p_arg_type =
- TYPE_FIELD_TYPE (func_type, i);
+ func_type->field (i).type ();
p_arg_size = TYPE_LENGTH (p_arg_type);
}
n = type->num_fields ();
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 0;
}
/* If the first field in the aggregate has the same length as the entire
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;
/* 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,
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;
/* Otherwise use struct convention. */
return 0;
/* Otherwise if the type of that member is float, the whole type is
treated as float. */
- if (TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_FLT)
+ if (type->field (0).type ()->code () == TYPE_CODE_FLT)
return 1;
/* Otherwise it's not treated as float. */
return 0;
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))
return 1;
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);
sparc64_store_floating_fields (regcache, subtype, valbuf,
value in %f1 too (we already have stored in %f0). */
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)
regcache->cooked_write (SPARC_F1_REGNUM, valbuf);
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);
sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos);
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)
{
/* Since union fields don't have the concept of offsets, we just
|| type->code () == TYPE_CODE_UNION)
&& 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)
return 0;
and which contains no arrays of more than two elements -> returned in
register. */
if (type->code () == TYPE_CODE_STRUCT
- && v850_type_is_scalar (TYPE_FIELD_TYPE (type, 0))
- && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4)
+ && v850_type_is_scalar (type->field (0).type ())
+ && TYPE_LENGTH (type->field (0).type ()) == 4)
{
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)
{
tgt_type = TYPE_TARGET_TYPE (fld_type);
{
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))
return 0;
}
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;
}
}
if (t_field_name
&& 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
|| field_type->code () == TYPE_CODE_STRUCT)
{
if (!field_is_static (&t->field (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);
}
{
type *t = (methods != NULL
? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ())
- : TYPE_FIELD_TYPE (SYMBOL_TYPE (functions[ix]),
- jj));
+ : SYMBOL_TYPE (functions[ix])->field (jj).type ());
parm_types.push_back (t);
}
}
/* Special case: a method taking void. T1 will contain no
non-artificial fields, and T2 will contain TYPE_CODE_VOID. */
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;
if ((t1->num_fields () - start) == t2->num_fields ())
for (i = 0; i < t2->num_fields (); ++i)
{
- if (compare_ranks (rank_one_type (TYPE_FIELD_TYPE (t1, start + i),
- TYPE_FIELD_TYPE (t2, i), NULL),
+ if (compare_ranks (rank_one_type (t1->field (start + i).type (),
+ t2->field (i).type (), NULL),
EXACT_MATCH_BADNESS) != 0)
return 0;
}
{
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 (BASETYPE_VIA_VIRTUAL (vt, i))
if (want_address)
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));
else if (noside != EVAL_NORMAL)
- return allocate_value (TYPE_FIELD_TYPE (t, i));
+ return allocate_value (t->field (i).type ());
else
{
/* Try to evaluate NAME as a qualified name with implicit
{
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
/* We require boolean types here to be one bit wide. This is a
switch (TYPE_FIELD_LOC_KIND (type, fieldno))
{
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));
break;
case FIELD_LOC_KIND_PHYSNAME:
reported as non-debuggable symbols. */
struct bound_minimal_symbol msym
= 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)
retval = allocate_optimized_out_value (field_type);
int unit_size = gdbarch_addressable_memory_unit_size (arch);
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
is a TYPE_CODE_TYPEDEF, its length is set to the length
{
int bitpos = TYPE_FIELD_BITPOS (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;
gdb_assert (val != NULL);
{
int bitpos = TYPE_FIELD_BITPOS (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);
}
{
int bitpos = TYPE_FIELD_BITPOS (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,
valaddr, embedded_offset, val);