aboutsummaryrefslogtreecommitdiff
path: root/gdb/coffread.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/coffread.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/coffread.c')
-rw-r--r--gdb/coffread.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 6bf3abd..9b2f638 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1456,12 +1456,10 @@ patch_type (struct type *type, struct type *real_type)
TYPE_LENGTH (target) = TYPE_LENGTH (real_target);
target->set_num_fields (real_target->num_fields ());
- TYPE_FIELDS (target) = (struct field *) TYPE_ALLOC (target,
- field_size);
- memcpy (TYPE_FIELDS (target),
- TYPE_FIELDS (real_target),
- field_size);
+ field *fields = (struct field *) TYPE_ALLOC (target, field_size);
+ memcpy (fields, real_target->fields (), field_size);
+ target->set_fields (fields);
if (real_target->name ())
{
@@ -1882,7 +1880,7 @@ decode_base_type (struct coff_symbol *cs,
type->set_name (NULL);
INIT_CPLUS_SPECIFIC (type);
TYPE_LENGTH (type) = 0;
- TYPE_FIELDS (type) = 0;
+ type->set_fields (nullptr);
type->set_num_fields (0);
}
else
@@ -1902,7 +1900,7 @@ decode_base_type (struct coff_symbol *cs,
type->set_name (NULL);
INIT_CPLUS_SPECIFIC (type);
TYPE_LENGTH (type) = 0;
- TYPE_FIELDS (type) = 0;
+ type->set_fields (nullptr);
type->set_num_fields (0);
}
else
@@ -1923,7 +1921,7 @@ decode_base_type (struct coff_symbol *cs,
type->set_code (TYPE_CODE_ENUM);
type->set_name (NULL);
TYPE_LENGTH (type) = 0;
- TYPE_FIELDS (type) = 0;
+ type->set_fields (nullptr);
type->set_num_fields (0);
}
else
@@ -2041,8 +2039,8 @@ coff_read_struct_type (int index, int length, int lastsym,
/* Now create the vector of fields, and record how big it is. */
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));
/* Copy the saved-up fields into the field vector. */
@@ -2121,8 +2119,8 @@ coff_read_enum_type (int index, int length, int lastsym,
TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
type->set_code (TYPE_CODE_ENUM);
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));
/* Find the symbols for the values and put them into the type.
The symbols can be found in the symlist that we put them on