gdb: add type::is_fixed_instance / type::set_is_fixed_instance

Add the `is_fixed_instance` and `set_is_fixed_instance` methods on `struct
type`, in order to remove the `TYPE_FIXED_INSTANCE` 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) <is_fixed_instance,
	set_is_fixed_instance>: New methods.
	(TYPE_FIXED_INSTANCE): Use type::is_fixed_instance, change all
	write call sites to use type::set_is_fixed_instance.

Change-Id: I4401d81512fab9eab4232bbea48ce6c7d586b94c
This commit is contained in:
Simon Marchi 2020-09-14 11:08:06 -04:00
parent 0becda7a5a
commit 9cdd0d12cc
3 changed files with 25 additions and 8 deletions

View file

@ -226,7 +226,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
further interpretation. Optionally marks ordinary, fixed-size GDB
type. */
#define TYPE_FIXED_INSTANCE(t) (TYPE_MAIN_TYPE (t)->flag_fixed_instance)
#define TYPE_FIXED_INSTANCE(t) ((t)->is_fixed_instance ())
/* * Not textual. By default, GDB treats all single byte integers as
characters (or elements of strings) unless this flag is set. */
@ -808,7 +808,7 @@ struct main_type
unsigned int m_flag_vector : 1;
unsigned int m_flag_stub_supported : 1;
unsigned int m_flag_gnu_ifunc : 1;
unsigned int flag_fixed_instance : 1;
unsigned int m_flag_fixed_instance : 1;
unsigned int flag_objfile_owned : 1;
unsigned int flag_endianity_not_default : 1;
@ -1141,6 +1141,16 @@ struct type
this->main_type->m_flag_gnu_ifunc = is_gnu_ifunc;
}
bool is_fixed_instance () const
{
return this->main_type->m_flag_fixed_instance;
}
void set_is_fixed_instance (bool is_fixed_instance)
{
this->main_type->m_flag_fixed_instance = is_fixed_instance;
}
/* * 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;