[PATCH 1/4] gdb: add type::num_fields / type::set_num_fields

Tom Tromey tom@tromey.com
Fri May 22 20:16:24 GMT 2020


>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> Add the `num_fields` and `set_num_fields` methods on `struct type`, in
Simon> order to remove the `TYPE_NFIELDS` macro.  In this patch, the
Simon> `TYPE_NFIELDS` macro is changed to use `type::num_fields`, so all the
Simon> call sites that are used to set the number of fields are changed to use
Simon> `type::set_num_fields`.  The next patch will remove `TYPE_NFIELDS`
Simon> completely.

This looks good.

Simon> I think that in the future, we should consider making the interface of
Simon> `struct type` better.  For example, right now it's possible for the
Simon> number of fields property and the actual number of fields set to be out
Simon> of sync.  However, I want to keep the existing behavior in this patch,
Simon> just translate from macros to methods.

Fully agreed.

Tom


More information about the Gdb-patches mailing list