gdb: add type::is_stub / type::set_is_stub

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

Change-Id: Ie935e8fe72c908afd8718411e83f4ff00c386bf3
This commit is contained in:
Simon Marchi
2020-09-14 11:07:58 -04:00
parent 20ce41238d
commit b4b7375953
7 changed files with 31 additions and 15 deletions

View File

@ -220,7 +220,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
if someone referenced a type that wasn't defined in a source file
via (struct sir_not_appearing_in_this_film *)). */
#define TYPE_STUB(t) (TYPE_MAIN_TYPE (t)->flag_stub)
#define TYPE_STUB(t) ((t)->is_stub ())
/* * The target type of this type is a stub type, and this type needs
to be updated if it gets un-stubbed in check_typedef. Used for
@ -846,7 +846,7 @@ struct main_type
unsigned int m_flag_unsigned : 1;
unsigned int m_flag_nosign : 1;
unsigned int flag_stub : 1;
unsigned int m_flag_stub : 1;
unsigned int flag_target_stub : 1;
unsigned int flag_prototyped : 1;
unsigned int flag_varargs : 1;
@ -1084,6 +1084,16 @@ struct type
this->main_type->m_flag_nosign = has_no_signedness;
}
bool is_stub () const
{
return this->main_type->m_flag_stub;
}
void set_is_stub (bool is_stub)
{
this->main_type->m_flag_stub = is_stub;
}
/* * 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;