gdb: add type::has_no_signedness / type::set_has_no_signedness

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

Change-Id: I80d8e774316d146fbd814b2928ad5392bada39d5
This commit is contained in:
Simon Marchi
2020-09-14 11:07:57 -04:00
parent c6d940a956
commit 15152a54ae
7 changed files with 26 additions and 9 deletions

View File

@ -214,7 +214,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
"unsigned char" are distinct types; so we need an extra flag to
indicate the absence of a sign! */
#define TYPE_NOSIGN(t) (TYPE_MAIN_TYPE (t)->flag_nosign)
#define TYPE_NOSIGN(t) ((t)->has_no_signedness ())
/* * A compiler may supply dwarf instrumentation
that indicates the desired endian interpretation of the variable
@ -851,7 +851,7 @@ struct main_type
documentation about these fields. */
unsigned int m_flag_unsigned : 1;
unsigned int flag_nosign : 1;
unsigned int m_flag_nosign : 1;
unsigned int flag_stub : 1;
unsigned int flag_target_stub : 1;
unsigned int flag_prototyped : 1;
@ -1076,6 +1076,16 @@ struct type
this->main_type->m_flag_unsigned = is_unsigned;
}
bool has_no_signedness () const
{
return this->main_type->m_flag_nosign;
}
void set_has_no_signedness (bool has_no_signedness)
{
this->main_type->m_flag_nosign = has_no_signedness;
}
/* * 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;