gdb: add type::is_unsigned / type::set_is_unsigned

Add the `is_unsigned` and `set_is_unsigned` methods on `struct type`, in
order to remove the `TYPE_UNSIGNED` macro.  In this patch, the
`TYPE_UNSIGNED` macro is changed to use `type::is_unsigned`, so all the
call sites that are used to set this property on a type are changed to
use the new method.  The next patch will remove the macro completely.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <is_unsigned, set_is_unsigned>: New
	methods.
	(TYPE_UNSIGNED): Use type::is_unsigned.  Change all write call
	sites to use type::set_is_unsigned.

Change-Id: Ib09ddce84eda160a801a8f288cccf61c8ef136bc
This commit is contained in:
Simon Marchi 2020-09-14 11:07:56 -04:00
parent 55ea94da36
commit 653223d356
10 changed files with 48 additions and 27 deletions

View file

@ -213,7 +213,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
/* * Unsigned integer type. If this is not set for a TYPE_CODE_INT,
the type is signed (unless TYPE_NOSIGN (below) is set). */
#define TYPE_UNSIGNED(t) (TYPE_MAIN_TYPE (t)->flag_unsigned)
#define TYPE_UNSIGNED(t) ((t)->is_unsigned ())
/* * No sign for this type. In C++, "char", "signed char", and
"unsigned char" are distinct types; so we need an extra flag to
@ -855,7 +855,7 @@ struct main_type
because they packs nicely here. See the TYPE_* macros for
documentation about these fields. */
unsigned int flag_unsigned : 1;
unsigned int m_flag_unsigned : 1;
unsigned int flag_nosign : 1;
unsigned int flag_stub : 1;
unsigned int flag_target_stub : 1;
@ -1068,6 +1068,16 @@ struct type
return this->bounds ()->bit_stride ();
}
bool is_unsigned () const
{
return this->main_type->m_flag_unsigned;
}
void set_is_unsigned (bool is_unsigned)
{
this->main_type->m_flag_unsigned = is_unsigned;
}
/* * 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;