aboutsummaryrefslogtreecommitdiff
path: root/gdb/stabsread.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-05-22 16:55:16 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-05-22 16:55:16 -0400
commit3cabb6b0694b65c7b5ed800822ca08bd899fc1d1 (patch)
tree58ba2ab20a5c34f30dff225f099dea06d0ef531e /gdb/stabsread.c
parent1f704f761b34e145f5eabdc222301ce6e9ec9102 (diff)
downloadgdb-3cabb6b0694b65c7b5ed800822ca08bd899fc1d1.zip
gdb-3cabb6b0694b65c7b5ed800822ca08bd899fc1d1.tar.gz
gdb-3cabb6b0694b65c7b5ed800822ca08bd899fc1d1.tar.bz2
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
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r--gdb/stabsread.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index daf88c8..e710a43 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -986,8 +986,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
}
/* Allocate parameter information fields and fill them in. */
- TYPE_FIELDS (ftype) = (struct field *)
- TYPE_ALLOC (ftype, nsemi * sizeof (struct field));
+ ftype->set_fields
+ ((struct field *)
+ TYPE_ALLOC (ftype, nsemi * sizeof (struct field)));
while (*p++ == ';')
{
struct type *ptype;
@@ -1836,9 +1837,9 @@ again:
&& arg_types->type->code () == TYPE_CODE_VOID)
num_args = 0;
- TYPE_FIELDS (func_type)
- = (struct field *) TYPE_ALLOC (func_type,
- num_args * sizeof (struct field));
+ func_type->set_fields
+ ((struct field *) TYPE_ALLOC (func_type,
+ num_args * sizeof (struct field)));
memset (TYPE_FIELDS (func_type), 0, num_args * sizeof (struct field));
{
int i;
@@ -3309,8 +3310,9 @@ attach_fields_to_type (struct stab_field_info *fip, struct type *type,
array of fields, and create blank visibility bitfields if necessary. */
type->set_num_fields (nfields);
- TYPE_FIELDS (type) = (struct field *)
- TYPE_ALLOC (type, sizeof (struct field) * nfields);
+ type->set_fields
+ ((struct field *)
+ TYPE_ALLOC (type, sizeof (struct field) * nfields));
memset (TYPE_FIELDS (type), 0, sizeof (struct field) * nfields);
if (non_public_fields)
@@ -3655,8 +3657,9 @@ read_enum_type (const char **pp, struct type *type,
if (unsigned_enum)
TYPE_UNSIGNED (type) = 1;
type->set_num_fields (nsyms);
- TYPE_FIELDS (type) = (struct field *)
- TYPE_ALLOC (type, sizeof (struct field) * nsyms);
+ type->set_fields
+ ((struct field *)
+ TYPE_ALLOC (type, sizeof (struct field) * nsyms));
memset (TYPE_FIELDS (type), 0, sizeof (struct field) * nsyms);
/* Find the symbols for the values and put them into the type.