gdb: add type::endianity_is_not_default / type::set_endianity_is_not_default

Add the `endianity_is_not_default` and `set_endianity_is_not_default`
methods on `struct type`, in order to remove the
`TYPE_ENDIANITY_NOT_DEFAULT` macro.  In this patch, the macro is changed
to use the getter, so all the call sites of the macro that are used as a
setter are changed to use the setter method directly.  The next patch
will remove the macro completely.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <endianity_is_not_default,
	set_endianity_is_not_default>: New methods.
	(TYPE_ENDIANITY_NOT_DEFAULT): Use
	type::endianity_is_not_default, change all write call sites to
	use type::set_endianity_is_not_default.

Change-Id: I67acd68fcdae424d7e4a601afda78612ad5d92db
This commit is contained in:
Simon Marchi
2020-09-14 11:08:07 -04:00
parent 22c4c60c86
commit db558e34b0
4 changed files with 23 additions and 5 deletions

View File

@ -214,7 +214,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
that indicates the desired endian interpretation of the variable
differs from the native endian representation. */
#define TYPE_ENDIANITY_NOT_DEFAULT(t) (TYPE_MAIN_TYPE (t)->flag_endianity_not_default)
#define TYPE_ENDIANITY_NOT_DEFAULT(t) ((t)->endianity_is_not_default ())
/* * Not textual. By default, GDB treats all single byte integers as
characters (or elements of strings) unless this flag is set. */
@ -798,7 +798,7 @@ struct main_type
unsigned int m_flag_gnu_ifunc : 1;
unsigned int m_flag_fixed_instance : 1;
unsigned int flag_objfile_owned : 1;
unsigned int flag_endianity_not_default : 1;
unsigned int m_flag_endianity_not_default : 1;
/* * True if this type was declared with "class" rather than
"struct". */
@ -1149,6 +1149,16 @@ struct type
this->main_type->m_flag_fixed_instance = is_fixed_instance;
}
bool endianity_is_not_default () const
{
return this->main_type->m_flag_endianity_not_default;
}
void set_endianity_is_not_default (bool endianity_is_not_default)
{
this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
}
/* * 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;