gdb: add type::fields / type::set_fields

Add the `fields` and `set_fields` methods on `struct type`, in order to
remove the `TYPE_FIELDS` macro.  In this patch, the `TYPE_FIELDS` macro
is changed to the `type::fields`, so all the call sites that use it to
set the fields array are changed to use `type::set_fields`.  The next
patch will remove `TYPE_FIELDS` entirely.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <fields, set_fields>: New methods.
	(TYPE_FIELDS): Use type::fields.  Change all call sites that
	modify the propery to use type::set_fields instead.

Change-Id: I05174ce68f2ce3fccdf5d8b469ff141f14886b33
This commit is contained in:
Simon Marchi 2020-05-22 16:55:16 -04:00
parent 1f704f761b
commit 3cabb6b069
14 changed files with 114 additions and 86 deletions

View file

@ -913,6 +913,18 @@ struct type
this->main_type->nfields = num_fields;
}
/* Get the fields array of this type. */
field *fields () const
{
return this->main_type->flds_bnds.fields;
}
/* Set the fields array of this type. */
void set_fields (field *fields)
{
this->main_type->flds_bnds.fields = fields;
}
/* * Return the dynamic property of the requested KIND from this type's
list of dynamic properties. */
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
@ -1458,7 +1470,7 @@ extern unsigned type_align (struct type *);
space in struct type. */
extern bool set_type_align (struct type *, ULONGEST);
#define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields
#define TYPE_FIELDS(thistype) (thistype)->fields ()
#define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
#define TYPE_RANGE_DATA(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.bounds