diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-05-22 16:55:14 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-05-22 16:55:14 -0400 |
commit | 5e33d5f4e1a5f2c3556ee31715ddc030d039b597 (patch) | |
tree | e58db956a72805d8a2a800cf0b913fd5808933ed /gdb/mdebugread.c | |
parent | 9392ebb3bbe4a43726ee8939c5447d88c7d3c1e4 (diff) | |
download | gdb-5e33d5f4e1a5f2c3556ee31715ddc030d039b597.zip gdb-5e33d5f4e1a5f2c3556ee31715ddc030d039b597.tar.gz gdb-5e33d5f4e1a5f2c3556ee31715ddc030d039b597.tar.bz2 |
gdb: add type::num_fields / type::set_num_fields
Add the `num_fields` and `set_num_fields` methods on `struct type`, in
order to remove the `TYPE_NFIELDS` macro. In this patch, the
`TYPE_NFIELDS` macro is changed to use `type::num_fields`, so all the
call sites that are used to set the number of fields are changed to use
`type::set_num_fields`. The next patch will remove `TYPE_NFIELDS`
completely.
I think that in the future, we should consider making the interface of
`struct type` better. For example, right now it's possible for the
number of fields property and the actual number of fields set to be out
of sync. However, I want to keep the existing behavior in this patch,
just translate from macros to methods.
gdb/ChangeLog:
* gdbtypes.h (struct type) <num_fields, set_num_fields>: New
methods.
(TYPE_NFIELDS): Use type::num_fields. Change all call sites
that modify the number of fields to use type::set_num_fields
instead.
Change-Id: I5ad9de5be4097feaf942d111077434bf91d13dc5
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r-- | gdb/mdebugread.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 9ad9c66..1b499cc 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1017,7 +1017,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, t->set_code (type_code); TYPE_LENGTH (t) = sh->value; - TYPE_NFIELDS (t) = nfields; + t->set_num_fields (nfields); TYPE_FIELDS (t) = f = ((struct field *) TYPE_ALLOC (t, nfields * sizeof (struct field))); @@ -1186,7 +1186,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, { struct block_iterator iter; - TYPE_NFIELDS (ftype) = nparams; + ftype->set_num_fields (nparams); TYPE_FIELDS (ftype) = (struct field *) TYPE_ALLOC (ftype, nparams * sizeof (struct field)); @@ -1733,7 +1733,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, /* Deal with range types. */ if (t->bt == btRange) { - TYPE_NFIELDS (tp) = 0; + tp->set_num_fields (0); TYPE_RANGE_DATA (tp) = ((struct range_bounds *) TYPE_ZALLOC (tp, sizeof (struct range_bounds))); TYPE_LOW_BOUND (tp) = AUX_GET_DNLOW (bigend, ax); |