public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: add type::index_type / type::set_index_type Date: Mon, 8 Jun 2020 19:53:38 +0000 (GMT) [thread overview] Message-ID: <20200608195338.22AE0385DC00@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=262abc0d67af006a709d0935940f9c9f5f7c5ee5 commit 262abc0d67af006a709d0935940f9c9f5f7c5ee5 Author: Simon Marchi <simon.marchi@efficios.com> Date: Mon Jun 8 15:25:50 2020 -0400 gdb: add type::index_type / type::set_index_type Add the `index_type` and `set_index_type` methods on `struct type`, in order to remove the `TYPE_INDEX_TYPE` macro. In this patch, the `TYPE_INDEX_TYPE` macro is changed to use `type::index_type`, so all the call sites that are used to set the type's index type are changed to use `type::set_index_type`. The next patch will remove `TYPE_INDEX_TYPE` completely. gdb/ChangeLog: * gdbtypes.h (struct type) <index_type, set_index_type>: New methods. (TYPE_INDEX_TYPE): Use type::index_type. * gdbtypes.c (create_array_type_with_stride): Likewise. Change-Id: I93bdca9de9f3e143d2ccea59310c63745315e18d Diff: --- gdb/ChangeLog | 7 +++++++ gdb/gdbtypes.c | 2 +- gdb/gdbtypes.h | 12 +++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 02880536568..6870b2ca5bf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2020-06-08 Simon Marchi <simon.marchi@efficios.com> + + * gdbtypes.h (struct type) <index_type, set_index_type>: New + methods. + (TYPE_INDEX_TYPE): Use type::index_type. + * gdbtypes.c (create_array_type_with_stride): Likewise. + 2020-06-07 Tom Tromey <tom@tromey.com> * valprint.c (generic_val_print_float): Remove "embedded_offset" diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index fa90bd1c051..67fd3d20a8f 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1293,7 +1293,7 @@ create_array_type_with_stride (struct type *result_type, result_type->set_num_fields (1); result_type->set_fields ((struct field *) TYPE_ZALLOC (result_type, sizeof (struct field))); - TYPE_INDEX_TYPE (result_type) = range_type; + result_type->set_index_type (range_type); if (byte_stride_prop != NULL) result_type->add_dyn_prop (DYN_PROP_BYTE_STRIDE, *byte_stride_prop); else if (bit_stride > 0) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 47d79afe2e6..0cca0fdbd1d 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -933,6 +933,16 @@ struct type this->main_type->flds_bnds.fields = fields; } + type *index_type () const + { + return this->field (0).type; + } + + void set_index_type (type *index_type) + { + this->field (0).type = index_type; + } + /* * 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; @@ -1482,7 +1492,7 @@ extern unsigned type_align (struct type *); space in struct type. */ extern bool set_type_align (struct type *, ULONGEST); -#define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0) +#define TYPE_INDEX_TYPE(type) ((type)->index_type ()) #define TYPE_RANGE_DATA(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.bounds #define TYPE_LOW_BOUND(range_type) \ TYPE_RANGE_DATA(range_type)->low.data.const_val
reply other threads:[~2020-06-08 19:53 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200608195338.22AE0385DC00@sourceware.org \ --to=simark@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).