gdb: remove TYPE_FIELD macro

Replace all uses of it by type::field.

Note that since type::field returns a reference to the field, some spots
are used to assign the whole field structure.  See ctfread.c, function
attach_fields_to_type, for example.  This is the same as was happening
with the macro, so I don't think it's a problem, but if anybody sees a
really nicer way to do this, now could be a good time to implement it.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_FIELD): Remove.  Replace all uses with
	type::field.
This commit is contained in:
Simon Marchi 2020-05-23 17:39:54 -04:00
parent 26f1625454
commit ceacbf6edf
31 changed files with 84 additions and 81 deletions

View File

@ -1,3 +1,8 @@
2020-05-23 Simon Marchi <simon.marchi@polymtl.ca>
* gdbtypes.h (TYPE_FIELD): Remove. Replace all uses with
type::field.
2020-05-23 Joel Brobecker <brobecker@adacore.com>
GDB 9.2 released.

View File

@ -1349,7 +1349,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
for (int i = 0; i < type->num_fields (); i++)
{
/* Ignore any static fields. */
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
continue;
struct type *member = check_typedef (TYPE_FIELD_TYPE (type, i));
@ -1631,7 +1631,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
for (int i = 0; i < arg_type->num_fields (); i++)
{
/* Don't include static fields. */
if (field_is_static (&TYPE_FIELD (arg_type, i)))
if (field_is_static (&arg_type->field (i)))
continue;
struct value *field = value_primitive_field (arg, 0, i, arg_type);

View File

@ -8090,7 +8090,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
{
off = align_up (off, field_alignment (type, f))
+ TYPE_FIELD_BITPOS (type, f);
SET_FIELD_BITPOS (TYPE_FIELD (rtype, f), off);
SET_FIELD_BITPOS (rtype->field (f), off);
TYPE_FIELD_BITSIZE (rtype, f) = 0;
if (ada_is_variant_part (type, f))

View File

@ -558,7 +558,7 @@ amd64_has_unaligned_fields (struct type *type)
/* Ignore static fields, empty fields (for example nested
empty structures), and bitfields (these are handled by
the caller). */
if (field_is_static (&TYPE_FIELD (type, i))
if (field_is_static (&type->field (i))
|| (TYPE_FIELD_BITSIZE (type, i) == 0
&& TYPE_LENGTH (subtype) == 0)
|| TYPE_FIELD_PACKED (type, i))
@ -600,7 +600,7 @@ amd64_classify_aggregate_field (struct type *type, int i,
/* Ignore static fields, or empty fields, for example nested
empty structures.*/
if (field_is_static (&TYPE_FIELD (type, i)) || bitsize == 0)
if (field_is_static (&type->field (i)) || bitsize == 0)
return;
if (subtype->code () == TYPE_CODE_STRUCT

View File

@ -3501,7 +3501,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
{
int sub_count = 0;
if (!field_is_static (&TYPE_FIELD (t, i)))
if (!field_is_static (&t->field (i)))
sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i),
base_type);
if (sub_count == -1)

View File

@ -318,7 +318,7 @@ gen_trace_static_fields (struct agent_expr *ax,
for (i = type->num_fields () - 1; i >= nbases; i--)
{
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
{
gen_static_field (ax, &value, type, i);
if (value.optimized_out)
@ -1456,7 +1456,7 @@ gen_struct_ref_recursive (struct agent_expr *ax, struct axs_value *value,
"this") will have been generated already, which will
be unnecessary but not harmful if the static field is
being handled as a global. */
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
{
gen_static_field (ax, value, type, i);
if (value->optimized_out)
@ -1594,7 +1594,7 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
if (t_field_name && strcmp (t_field_name, fieldname) == 0)
{
if (field_is_static (&TYPE_FIELD (t, i)))
if (field_is_static (&t->field (i)))
{
gen_static_field (ax, value, t, i);
if (value->optimized_out)

View File

@ -1167,7 +1167,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
TYPE_FIELD_PRIVATE (type, i), flags);
}
bool is_static = field_is_static (&TYPE_FIELD (type, i));
bool is_static = field_is_static (&type->field (i));
if (flags->print_offsets)
podata->update (type, i, stream);

View File

@ -254,7 +254,7 @@ value_struct_element_index (struct value *value, int type_index)
try
{
if (field_is_static (&TYPE_FIELD (type, type_index)))
if (field_is_static (&type->field (type_index)))
result = value_static_field (type, type_index);
else
result = value_primitive_field (value, 0, type_index, type);

View File

@ -2045,7 +2045,7 @@ coff_read_struct_type (int index, int length, int lastsym,
/* Copy the saved-up fields into the field vector. */
for (n = nfields; list; list = list->next)
TYPE_FIELD (type, --n) = list->field;
type->field (--n) = list->field;
return type;
}
@ -2142,7 +2142,7 @@ coff_read_enum_type (int index, int length, int lastsym,
SYMBOL_TYPE (xsym) = type;
TYPE_FIELD_NAME (type, n) = xsym->linkage_name ();
SET_FIELD_ENUMVAL (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym));
SET_FIELD_ENUMVAL (type->field (n), SYMBOL_VALUE (xsym));
if (SYMBOL_VALUE (xsym) < 0)
unsigned_enum = 0;
TYPE_FIELD_BITSIZE (type, n) = 0;

View File

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

View File

@ -595,7 +595,7 @@ compile_cplus_convert_struct_or_union_members
gcc_type field_type
= instance->convert_type (TYPE_FIELD_TYPE (type, i));
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
{
CORE_ADDR physaddr;

View File

@ -191,7 +191,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
/* If requested, skip printing of static fields. */
if (!options->static_field_print
&& field_is_static (&TYPE_FIELD (type, i)))
&& field_is_static (&type->field (i)))
continue;
if (fields_seen)
@ -225,7 +225,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
annotate_field_begin (TYPE_FIELD_TYPE (type, i));
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
{
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream,
@ -256,7 +256,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
}
annotate_field_value ();
if (!field_is_static (&TYPE_FIELD (type, i))
if (!field_is_static (&type->field (i))
&& TYPE_FIELD_PACKED (type, i))
{
struct value *v;
@ -295,7 +295,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
fputs_styled ("<optimized out or zero length>",
metadata_style.style (), stream);
}
else if (field_is_static (&TYPE_FIELD (type, i)))
else if (field_is_static (&type->field (i)))
{
try
{

View File

@ -316,7 +316,7 @@ attach_fields_to_type (struct ctf_field_info *fip, struct type *type)
for (int i = 0; i < nfields; ++i)
{
struct ctf_nextfield &field = fip->fields[i];
TYPE_FIELD (type, i) = field.field;
type->field (i) = field.field;
}
}

View File

@ -9364,7 +9364,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
type->set_code (TYPE_CODE_STRUCT);
type->set_num_fields (3);
/* Save the field we care about. */
struct field saved_field = TYPE_FIELD (type, 0);
struct field saved_field = type->field (0);
type->set_fields
((struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field)));
@ -9372,11 +9372,11 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
TYPE_FIELD_TYPE (type, 0) = field_type;
TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
SET_FIELD_BITPOS (TYPE_FIELD (type, 0), bit_offset);
SET_FIELD_BITPOS (type->field (0), bit_offset);
/* The order of fields doesn't really matter, so put the real
field at index 1 and the data-less field at index 2. */
TYPE_FIELD (type, 1) = saved_field;
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
@ -9392,7 +9392,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* NAME points into the original discriminant name, which
already has the correct lifetime. */
TYPE_FIELD_NAME (type, 2) = name;
SET_FIELD_BITPOS (TYPE_FIELD (type, 2), 0);
SET_FIELD_BITPOS (type->field (2), 0);
/* Indicate that this is a variant type. */
static discriminant_range ranges[1] = { { 0, 0 } };
@ -9454,7 +9454,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
type->set_code (TYPE_CODE_STRUCT);
/* Make space for the discriminant field. */
struct field *disr_field = &TYPE_FIELD (disr_type, 0);
struct field *disr_field = &disr_type->field (0);
field *new_fields
= (struct field *) TYPE_ZALLOC (type, ((type->num_fields () + 1)
* sizeof (struct field)));
@ -9464,7 +9464,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
type->set_num_fields (type->num_fields () + 1);
/* Install the discriminant at index 0 in the union. */
TYPE_FIELD (type, 0) = *disr_field;
type->field (0) = *disr_field;
TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
@ -14849,7 +14849,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
= ((i < fip->baseclasses.size ()) ? fip->baseclasses[i]
: fip->fields[i - fip->baseclasses.size ()]);
TYPE_FIELD (type, i) = field.field;
type->field (i) = field.field;
switch (field.accessibility)
{
case DW_ACCESS_private:

View File

@ -296,8 +296,7 @@ evaluate_struct_tuple (struct value *struct_val,
fieldno++;
/* Skip static fields. */
while (fieldno < struct_type->num_fields ()
&& field_is_static (&TYPE_FIELD (struct_type,
fieldno)))
&& field_is_static (&struct_type->field (fieldno)))
fieldno++;
if (fieldno >= struct_type->num_fields ())
error (_("too many initializers"));

View File

@ -1757,7 +1757,7 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
return {&TYPE_FIELD (type, i), TYPE_FIELD_BITPOS (type, i)};
return {&type->field (i), TYPE_FIELD_BITPOS (type, i)};
}
else if (!t_field_name || *t_field_name == '\0')
{
@ -2039,7 +2039,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
for (i = 0; i < type->num_fields (); ++i)
{
/* Static fields can be ignored here. */
if (field_is_static (&TYPE_FIELD (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))
@ -2249,7 +2249,7 @@ resolve_dynamic_union (struct type *type,
{
struct type *t;
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
continue;
t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
@ -2415,7 +2415,7 @@ compute_variant_fields (struct type *type,
if (!flags[i])
continue;
TYPE_FIELD (resolved_type, out) = TYPE_FIELD (type, i);
resolved_type->field (out) = type->field (i);
++out;
}
}
@ -2463,7 +2463,7 @@ resolve_dynamic_struct (struct type *type,
unsigned new_bit_length;
struct property_addr_info pinfo;
if (field_is_static (&TYPE_FIELD (resolved_type, i)))
if (field_is_static (&resolved_type->field (i)))
continue;
if (TYPE_FIELD_LOC_KIND (resolved_type, i) == FIELD_LOC_KIND_DWARF_BLOCK)
@ -2480,7 +2480,7 @@ resolve_dynamic_struct (struct type *type,
CORE_ADDR addr;
if (dwarf2_evaluate_property (&prop, nullptr, addr_stack, &addr,
true))
SET_FIELD_BITPOS (TYPE_FIELD (resolved_type, i),
SET_FIELD_BITPOS (resolved_type->field (i),
TARGET_CHAR_BIT * (addr - addr_stack->addr));
}
@ -3391,7 +3391,7 @@ type_align (struct type *type)
int number_of_non_static_fields = 0;
for (unsigned i = 0; i < type->num_fields (); ++i)
{
if (!field_is_static (&TYPE_FIELD (type, i)))
if (!field_is_static (&type->field (i)))
{
number_of_non_static_fields++;
ULONGEST f_align = type_align (TYPE_FIELD_TYPE (type, i));
@ -4028,8 +4028,8 @@ check_types_equal (struct type *type1, struct type *type2,
for (i = 0; i < type1->num_fields (); ++i)
{
const struct field *field1 = &TYPE_FIELD (type1, i);
const struct field *field2 = &TYPE_FIELD (type2, i);
const struct field *field1 = &type1->field (i);
const struct field *field2 = &type2->field (i);
if (FIELD_ARTIFICIAL (*field1) != FIELD_ARTIFICIAL (*field2)
|| FIELD_BITSIZE (*field1) != FIELD_BITSIZE (*field2)
@ -5321,19 +5321,19 @@ copy_type_recursive (struct objfile *objfile,
switch (TYPE_FIELD_LOC_KIND (type, i))
{
case FIELD_LOC_KIND_BITPOS:
SET_FIELD_BITPOS (TYPE_FIELD (new_type, i),
SET_FIELD_BITPOS (new_type->field (i),
TYPE_FIELD_BITPOS (type, i));
break;
case FIELD_LOC_KIND_ENUMVAL:
SET_FIELD_ENUMVAL (TYPE_FIELD (new_type, i),
SET_FIELD_ENUMVAL (new_type->field (i),
TYPE_FIELD_ENUMVAL (type, i));
break;
case FIELD_LOC_KIND_PHYSADDR:
SET_FIELD_PHYSADDR (TYPE_FIELD (new_type, i),
SET_FIELD_PHYSADDR (new_type->field (i),
TYPE_FIELD_STATIC_PHYSADDR (type, i));
break;
case FIELD_LOC_KIND_PHYSNAME:
SET_FIELD_PHYSNAME (TYPE_FIELD (new_type, i),
SET_FIELD_PHYSNAME (new_type->field (i),
xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
i)));
break;
@ -5588,7 +5588,7 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
TYPE_FIELD_NAME (type, field_nr) = xstrdup (name);
TYPE_FIELD_TYPE (type, field_nr) = field_type;
SET_FIELD_BITPOS (TYPE_FIELD (type, field_nr), start_bitpos);
SET_FIELD_BITPOS (type->field (field_nr), start_bitpos);
TYPE_FIELD_BITSIZE (type, field_nr) = nr_bits;
type->set_num_fields (type->num_fields () + 1);
}

View File

@ -1613,18 +1613,17 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
#define TYPE_FIELD(thistype, n) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields[n]
#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n))
#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n))
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE((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_BITPOS(thistype, n) FIELD_BITPOS ((thistype)->field (n))
#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL ((thistype)->field (n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME ((thistype)->field (n))
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR ((thistype)->field (n))
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK ((thistype)->field (n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL((thistype)->field (n))
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE((thistype)->field (n))
#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE((thistype)->field (n))!=0)
#define TYPE_FIELD_PRIVATE_BITS(thistype) \
TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits

View File

@ -1528,7 +1528,7 @@ gnuv3_pass_by_reference (struct type *type)
about recursive loops here, since we are only looking at members
of complete class type. Also ignore any static members. */
for (fieldnum = 0; fieldnum < type->num_fields (); fieldnum++)
if (!field_is_static (&TYPE_FIELD (type, fieldnum)))
if (!field_is_static (&type->field (fieldnum)))
{
struct type *field_type = TYPE_FIELD_TYPE (type, fieldnum);

View File

@ -514,7 +514,7 @@ tyscm_field_smob_to_field (field_smob *f_smob)
/* This should be non-NULL by construction. */
gdb_assert (type->fields () != NULL);
return &TYPE_FIELD (type, f_smob->field_num);
return &type->field (f_smob->field_num);
}
/* Type smob accessors. */

View File

@ -4856,7 +4856,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type,
struct type *field_type;
/* We're only looking at normal fields. */
if (field_is_static (&TYPE_FIELD (arg_type, i))
if (field_is_static (&arg_type->field (i))
|| (TYPE_FIELD_BITPOS (arg_type, i) % 8) != 0)
continue;

View File

@ -618,12 +618,12 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
}
print_spaces_filtered (level + 4, stream);
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
fprintf_filtered (stream, "static ");
pascal_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 4, flags);
if (!field_is_static (&TYPE_FIELD (type, i))
if (!field_is_static (&type->field (i))
&& TYPE_FIELD_PACKED (type, i))
{
/* It is a bitfield. This code does not attempt

View File

@ -553,7 +553,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
{
/* If requested, skip printing of static fields. */
if (!options->pascal_static_field_print
&& field_is_static (&TYPE_FIELD (type, i)))
&& field_is_static (&type->field (i)))
continue;
if (fields_seen)
fprintf_filtered (stream, ", ");
@ -582,7 +582,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
annotate_field_begin (TYPE_FIELD_TYPE (type, i));
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
{
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream,
@ -597,7 +597,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
fputs_filtered (" = ", stream);
annotate_field_value ();
if (!field_is_static (&TYPE_FIELD (type, i))
if (!field_is_static (&type->field (i))
&& TYPE_FIELD_PACKED (type, i))
{
struct value *v;
@ -636,7 +636,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
fputs_styled ("<optimized out or zero length>",
metadata_style.style (), stream);
}
else if (field_is_static (&TYPE_FIELD (type, i)))
else if (field_is_static (&type->field (i)))
{
/* struct value *v = value_static_field (type, i);
v4.17 specific. */

View File

@ -1142,7 +1142,7 @@ ppc64_aggregate_candidate (struct type *type,
{
LONGEST sub_count;
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
continue;
sub_count = ppc64_aggregate_candidate

View File

@ -177,7 +177,7 @@ convert_field (struct type *type, int field)
if (PyObject_SetAttrString (result.get (), "parent_type", arg.get ()) < 0)
return NULL;
if (!field_is_static (&TYPE_FIELD (type, field)))
if (!field_is_static (&type->field (field)))
{
const char *attrstring;

View File

@ -128,7 +128,7 @@ rust_underscore_fields (struct type *type)
return false;
for (i = 0; i < type->num_fields (); ++i)
{
if (!field_is_static (&TYPE_FIELD (type, i)))
if (!field_is_static (&type->field (i)))
{
char buf[20];
@ -420,7 +420,7 @@ val_print_struct (struct value *val, struct ui_file *stream, int recurse,
first_field = 1;
for (i = 0; i < type->num_fields (); ++i)
{
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
continue;
if (!first_field)
@ -735,7 +735,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
std::vector<int> fields;
for (int i = 0; i < type->num_fields (); ++i)
{
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
continue;
if (is_enum && TYPE_FIELD_ARTIFICIAL (type, i))
continue;
@ -753,7 +753,7 @@ rust_print_struct_def (struct type *type, const char *varstring,
{
QUIT;
gdb_assert (!field_is_static (&TYPE_FIELD (type, i)));
gdb_assert (!field_is_static (&type->field (i)));
gdb_assert (! (is_enum && TYPE_FIELD_ARTIFICIAL (type, i)));
if (flags->print_offsets)
@ -992,7 +992,7 @@ rust_composite_type (struct type *original,
bitpos = 0;
if (field1 != NULL)
{
struct field *field = &TYPE_FIELD (result, i);
struct field *field = &result->field (i);
SET_FIELD_BITPOS (*field, bitpos);
bitpos += TYPE_LENGTH (type1) * TARGET_CHAR_BIT;
@ -1003,7 +1003,7 @@ rust_composite_type (struct type *original,
}
if (field2 != NULL)
{
struct field *field = &TYPE_FIELD (result, i);
struct field *field = &result->field (i);
unsigned align = type_align (type2);
if (align != 0)

View File

@ -1646,7 +1646,7 @@ s390_effective_inner_type (struct type *type, unsigned int min_size)
abort the unwrapping. */
for (int i = 0; i < type->num_fields (); i++)
{
struct field f = TYPE_FIELD (type, i);
struct field f = type->field (i);
if (field_is_static (&f))
continue;

View File

@ -3339,7 +3339,7 @@ attach_fields_to_type (struct stab_field_info *fip, struct type *type,
while (nfields-- > 0)
{
TYPE_FIELD (type, nfields) = fip->list->field;
type->field (nfields) = fip->list->field;
switch (fip->list->visibility)
{
case VISIBILITY_PRIVATE:
@ -3681,7 +3681,7 @@ read_enum_type (const char **pp, struct type *type,
SYMBOL_TYPE (xsym) = type;
TYPE_FIELD_NAME (type, n) = xsym->linkage_name ();
SET_FIELD_ENUMVAL (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym));
SET_FIELD_ENUMVAL (type->field (n), SYMBOL_VALUE (xsym));
TYPE_FIELD_BITSIZE (type, n) = 0;
}
if (syms == osyms)

View File

@ -1973,7 +1973,7 @@ check_field (struct type *type, const char *name,
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
is_a_field_of_this->type = type;
is_a_field_of_this->field = &TYPE_FIELD (type, i);
is_a_field_of_this->field = &type->field (i);
return 1;
}
}

View File

@ -110,7 +110,7 @@ void
print_offset_data::update (struct type *type, unsigned int field_idx,
struct ui_file *stream)
{
if (field_is_static (&TYPE_FIELD (type, field_idx)))
if (field_is_static (&type->field (field_idx)))
{
print_spaces_filtered (indentation, stream);
return;

View File

@ -1813,7 +1813,7 @@ do_search_struct_field (const char *name, struct value *arg1, LONGEST offset,
{
struct value *v;
if (field_is_static (&TYPE_FIELD (type, i)))
if (field_is_static (&type->field (i)))
v = value_static_field (type, i);
else
v = value_primitive_field (arg1, offset, i, type);
@ -2221,7 +2221,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
for (i = TYPE_N_BASECLASSES (t); i < t->num_fields (); i++)
{
if (!field_is_static (&TYPE_FIELD (t, i))
if (!field_is_static (&t->field (i))
&& bitpos == TYPE_FIELD_BITPOS (t, i)
&& types_equal (ftype, TYPE_FIELD_TYPE (t, i)))
return value_primitive_field (*argp, 0, i, t);
@ -3299,7 +3299,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
if (t_field_name && strcmp (t_field_name, name) == 0)
{
if (field_is_static (&TYPE_FIELD (t, i)))
if (field_is_static (&t->field (i)))
{
struct value *v = value_static_field (t, i);
if (want_address)

View File

@ -759,7 +759,7 @@ create_enum (struct gdbarch *gdbarch, int bit, const char *name,
for (i = 0; i < count; i++)
{
TYPE_FIELD_NAME (type, i) = values[i].name;
SET_FIELD_ENUMVAL (TYPE_FIELD (type, i), values[i].value);
SET_FIELD_ENUMVAL (type->field (i), values[i].value);
}
return type;