diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-05-14 13:45:40 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-05-14 13:45:40 -0400 |
commit | 67607e24d0413828acdfa9bc38f6fbac40b860b9 (patch) | |
tree | 244fb4d92616ef31b9b22197d5a90df09e0147b2 /gdb/gdbtypes.h | |
parent | 02eba61aa6cad683e96cf13f483adc04982c0c2b (diff) | |
download | binutils-gdb-67607e24d0413828acdfa9bc38f6fbac40b860b9.tar.gz |
gdb: add type::code / type::set_code
Add the code and set_code methods on code, in order to remove the
TYPE_CODE macro. In this patch, the TYPE_CODE macro is changed to use
type::code, so all the call sites that are used to set the type code are
changed to use type::set_code. The next patch will remove TYPE_CODE
completely.
gdb/ChangeLog:
* gdbtypes.h (struct type) <code, set_code>: New methods.
(TYPE_CODE): Use type::code. Change all call sites used to set
the code to use type::set_code instead.
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r-- | gdb/gdbtypes.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 7514bd27f7c..9f4924e9404 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -874,6 +874,21 @@ struct main_type struct type { + /* Get the type code of this type. + + Note that the code can be TYPE_CODE_TYPEDEF, so if you want the real + type, you need to do `check_typedef (type)->code ()`. */ + type_code code () const + { + return this->main_type->code; + } + + /* Set the type code of this type. */ + void set_code (type_code code) + { + this->main_type->code = code; + } + /* * 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; @@ -1420,9 +1435,7 @@ extern unsigned type_align (struct type *); space in struct type. */ extern bool set_type_align (struct type *, ULONGEST); -/* * Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real - type, you need to do TYPE_CODE (check_type (this_type)). */ -#define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code +#define TYPE_CODE(thistype) ((thistype)->code ()) #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields |