summaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-06-08 15:26:04 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-06-08 15:26:04 -0400
commit5d14b6e5d6525ce462c30501644922a10f8682eb (patch)
tree0f1ce729b9393dc161bbcc4fc70f5b7b0a3ff335 /gdb/gdbtypes.h
parent3d967001ecd3b325fc39d7f53ebf7054d1ecd503 (diff)
downloadbinutils-gdb-5d14b6e5d6525ce462c30501644922a10f8682eb.tar.gz
gdb: add field::type / field::set_type
Add the `type` and `set_type` methods on `struct field`, in order to remoremove the `FIELD_TYPE` macro. In this patch, the `FIELD_TYPE` macro is changed to use `field::type`, so all the call sites that are useused to set the field's type are changed to use `field::set_type`. The next patch will remove `FIELD_TYPE` completely. Note that because of the name clash between the existing field named `type` and the new method, I renamed the field `m_type`. It is not private per-se, because we can't make `struct field` a non-POD yet, but it should be considered private anyway (not accessed outside `struct field`). gdb/ChangeLog: * gdbtypes.h (struct field) <type, set_type>: New methods. Rename `type` field to... <m_type>: ... this. Change references throughout to use type or set_type methods. (FIELD_TYPE): Use field::type. Change call sites that modify the field's type to use field::set_type instead. Change-Id: Ie21f866e3b7f8a51ea49b722d07d272a724459a0
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r--gdb/gdbtypes.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index ffb8a616cfb..af5587592a4 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -635,6 +635,16 @@ union field_location
struct field
{
+ struct type *type () const
+ {
+ return this->m_type;
+ }
+
+ void set_type (struct type *type)
+ {
+ this->m_type = type;
+ }
+
union field_location loc;
/* * For a function or member type, this is 1 if the argument is
@@ -660,7 +670,7 @@ struct field
- In a function or member type, type of this argument.
- In an array type, the domain-type of the array. */
- struct type *type;
+ struct type *m_type;
/* * Name of field, value or argument.
NULL for range bounds, array domains, and member function
@@ -935,12 +945,12 @@ struct type
type *index_type () const
{
- return this->field (0).type;
+ return this->field (0).type ();
}
void set_index_type (type *index_type)
{
- this->field (0).type = index_type;
+ this->field (0).set_type (index_type);
}
/* * Return the dynamic property of the requested KIND from this type's
@@ -1600,7 +1610,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
-#define FIELD_TYPE(thisfld) ((thisfld).type)
+#define FIELD_TYPE(thisfld) ((thisfld).type ())
#define FIELD_NAME(thisfld) ((thisfld).name)
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)