gdb: remove TYPE_INSTANCE_FLAGS

Remove it, use the `type::instance_flags` method everywhere.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_INSTANCE_FLAGS): Remove, replace all uses
	with `type::instance_flags`.

Change-Id: I3653108b712e6186529cb0102e2b70247bbcabbe
This commit is contained in:
Simon Marchi
2020-09-14 22:22:33 -04:00
committed by Simon Marchi
parent 4a8f181d19
commit 10242f367f
7 changed files with 35 additions and 35 deletions

View File

@ -1,3 +1,8 @@
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (TYPE_INSTANCE_FLAGS): Remove, replace all uses
with `type::instance_flags`.
2020-09-14 Michael Mullin <masmullin@gmail.com> 2020-09-14 Michael Mullin <masmullin@gmail.com>
* xml-tdesc.c [!defined(HAVE_LIBEXPAT)] (tdesc_parse_xml): * xml-tdesc.c [!defined(HAVE_LIBEXPAT)] (tdesc_parse_xml):

View File

@ -528,7 +528,7 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
address_space_id address_space_id
= address_space_type_instance_flags_to_name (get_type_arch (type), = address_space_type_instance_flags_to_name (get_type_arch (type),
TYPE_INSTANCE_FLAGS (type)); type->instance_flags ());
if (address_space_id) if (address_space_id)
{ {
if (did_print_modifier || need_pre_space) if (did_print_modifier || need_pre_space)

View File

@ -278,9 +278,9 @@ convert_type_basic (compile_c_instance *context, struct type *type)
{ {
/* If we are converting a qualified type, first convert the /* If we are converting a qualified type, first convert the
unqualified type and then apply the qualifiers. */ unqualified type and then apply the qualifiers. */
if ((TYPE_INSTANCE_FLAGS (type) & (TYPE_INSTANCE_FLAG_CONST if ((type->instance_flags () & (TYPE_INSTANCE_FLAG_CONST
| TYPE_INSTANCE_FLAG_VOLATILE | TYPE_INSTANCE_FLAG_VOLATILE
| TYPE_INSTANCE_FLAG_RESTRICT)) != 0) | TYPE_INSTANCE_FLAG_RESTRICT)) != 0)
return convert_qualified (context, type); return convert_qualified (context, type);
switch (type->code ()) switch (type->code ())

View File

@ -1135,9 +1135,9 @@ convert_type_cplus_basic (compile_cplus_instance *instance,
{ {
/* If we are converting a qualified type, first convert the /* If we are converting a qualified type, first convert the
unqualified type and then apply the qualifiers. */ unqualified type and then apply the qualifiers. */
if ((TYPE_INSTANCE_FLAGS (type) & (TYPE_INSTANCE_FLAG_CONST if ((type->instance_flags () & (TYPE_INSTANCE_FLAG_CONST
| TYPE_INSTANCE_FLAG_VOLATILE | TYPE_INSTANCE_FLAG_VOLATILE
| TYPE_INSTANCE_FLAG_RESTRICT)) != 0) | TYPE_INSTANCE_FLAG_RESTRICT)) != 0)
return compile_cplus_convert_qualified (instance, type); return compile_cplus_convert_qualified (instance, type);
switch (type->code ()) switch (type->code ())

View File

@ -630,7 +630,7 @@ make_qualified_type (struct type *type, type_instance_flags new_flags,
ntype = type; ntype = type;
do do
{ {
if (TYPE_INSTANCE_FLAGS (ntype) == new_flags) if (ntype->instance_flags () == new_flags)
return ntype; return ntype;
ntype = TYPE_CHAIN (ntype); ntype = TYPE_CHAIN (ntype);
} }
@ -753,7 +753,7 @@ struct type *
make_restrict_type (struct type *type) make_restrict_type (struct type *type)
{ {
return make_qualified_type (type, return make_qualified_type (type,
(TYPE_INSTANCE_FLAGS (type) (type->instance_flags ()
| TYPE_INSTANCE_FLAG_RESTRICT), | TYPE_INSTANCE_FLAG_RESTRICT),
NULL); NULL);
} }
@ -764,7 +764,7 @@ struct type *
make_unqualified_type (struct type *type) make_unqualified_type (struct type *type)
{ {
return make_qualified_type (type, return make_qualified_type (type,
(TYPE_INSTANCE_FLAGS (type) (type->instance_flags ()
& ~(TYPE_INSTANCE_FLAG_CONST & ~(TYPE_INSTANCE_FLAG_CONST
| TYPE_INSTANCE_FLAG_VOLATILE | TYPE_INSTANCE_FLAG_VOLATILE
| TYPE_INSTANCE_FLAG_RESTRICT)), | TYPE_INSTANCE_FLAG_RESTRICT)),
@ -777,7 +777,7 @@ struct type *
make_atomic_type (struct type *type) make_atomic_type (struct type *type)
{ {
return make_qualified_type (type, return make_qualified_type (type,
(TYPE_INSTANCE_FLAGS (type) (type->instance_flags ()
| TYPE_INSTANCE_FLAG_ATOMIC), | TYPE_INSTANCE_FLAG_ATOMIC),
NULL); NULL);
} }
@ -825,7 +825,7 @@ replace_type (struct type *ntype, struct type *type)
/* Assert that the two types have equivalent instance qualifiers. /* Assert that the two types have equivalent instance qualifiers.
This should be true for at least all of our debug readers. */ This should be true for at least all of our debug readers. */
gdb_assert (TYPE_INSTANCE_FLAGS (ntype) == TYPE_INSTANCE_FLAGS (type)); gdb_assert (ntype->instance_flags () == type->instance_flags ());
} }
/* Implement direct support for MEMBER_TYPE in GNU C++. /* Implement direct support for MEMBER_TYPE in GNU C++.
@ -2834,9 +2834,7 @@ check_typedef (struct type *type)
move over any other types NEWTYPE refers to, which could move over any other types NEWTYPE refers to, which could
be an unbounded amount of stuff. */ be an unbounded amount of stuff. */
if (TYPE_OBJFILE (newtype) == TYPE_OBJFILE (type)) if (TYPE_OBJFILE (newtype) == TYPE_OBJFILE (type))
type = make_qualified_type (newtype, type = make_qualified_type (newtype, type->instance_flags (), type);
TYPE_INSTANCE_FLAGS (type),
type);
else else
type = newtype; type = newtype;
} }
@ -2862,9 +2860,8 @@ check_typedef (struct type *type)
with the complete type only if they are in the same with the complete type only if they are in the same
objfile. */ objfile. */
if (TYPE_OBJFILE (SYMBOL_TYPE (sym)) == TYPE_OBJFILE (type)) if (TYPE_OBJFILE (SYMBOL_TYPE (sym)) == TYPE_OBJFILE (type))
type = make_qualified_type (SYMBOL_TYPE (sym), type = make_qualified_type (SYMBOL_TYPE (sym),
TYPE_INSTANCE_FLAGS (type), type->instance_flags (), type);
type);
else else
type = SYMBOL_TYPE (sym); type = SYMBOL_TYPE (sym);
} }
@ -4001,7 +3998,7 @@ check_types_equal (struct type *type1, struct type *type2,
|| type1->has_varargs () != type2->has_varargs () || type1->has_varargs () != type2->has_varargs ()
|| type1->is_vector () != type2->is_vector () || type1->is_vector () != type2->is_vector ()
|| TYPE_NOTTEXT (type1) != TYPE_NOTTEXT (type2) || TYPE_NOTTEXT (type1) != TYPE_NOTTEXT (type2)
|| TYPE_INSTANCE_FLAGS (type1) != TYPE_INSTANCE_FLAGS (type2) || type1->instance_flags () != type2->instance_flags ()
|| type1->num_fields () != type2->num_fields ()) || type1->num_fields () != type2->num_fields ())
return false; return false;

View File

@ -213,7 +213,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
/* * Not textual. By default, GDB treats all single byte integers as /* * Not textual. By default, GDB treats all single byte integers as
characters (or elements of strings) unless this flag is set. */ characters (or elements of strings) unless this flag is set. */
#define TYPE_NOTTEXT(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_NOTTEXT) #define TYPE_NOTTEXT(t) (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_NOTTEXT)
/* * Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by /* * Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by
the objfile retrieved as TYPE_OBJFILE. Otherwise, the type is the objfile retrieved as TYPE_OBJFILE. Otherwise, the type is
@ -240,25 +240,25 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
/* * Constant type. If this is set, the corresponding type has a /* * Constant type. If this is set, the corresponding type has a
const modifier. */ const modifier. */
#define TYPE_CONST(t) ((TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_CONST) != 0) #define TYPE_CONST(t) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CONST) != 0)
/* * Volatile type. If this is set, the corresponding type has a /* * Volatile type. If this is set, the corresponding type has a
volatile modifier. */ volatile modifier. */
#define TYPE_VOLATILE(t) \ #define TYPE_VOLATILE(t) \
((TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_VOLATILE) != 0) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_VOLATILE) != 0)
/* * Restrict type. If this is set, the corresponding type has a /* * Restrict type. If this is set, the corresponding type has a
restrict modifier. */ restrict modifier. */
#define TYPE_RESTRICT(t) \ #define TYPE_RESTRICT(t) \
((TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_RESTRICT) != 0) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_RESTRICT) != 0)
/* * Atomic type. If this is set, the corresponding type has an /* * Atomic type. If this is set, the corresponding type has an
_Atomic modifier. */ _Atomic modifier. */
#define TYPE_ATOMIC(t) \ #define TYPE_ATOMIC(t) \
((TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_ATOMIC) != 0) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_ATOMIC) != 0)
/* * True if this type represents either an lvalue or lvalue reference type. */ /* * True if this type represents either an lvalue or lvalue reference type. */
@ -297,10 +297,10 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
is instruction space, and for data objects is data memory. */ is instruction space, and for data objects is data memory. */
#define TYPE_CODE_SPACE(t) \ #define TYPE_CODE_SPACE(t) \
((TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_CODE_SPACE) != 0) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CODE_SPACE) != 0)
#define TYPE_DATA_SPACE(t) \ #define TYPE_DATA_SPACE(t) \
((TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_DATA_SPACE) != 0) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_DATA_SPACE) != 0)
/* * Address class flags. Some environments provide for pointers /* * Address class flags. Some environments provide for pointers
whose size is different from that of a normal pointer or address whose size is different from that of a normal pointer or address
@ -309,13 +309,13 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
target specific ways to represent these different types of address target specific ways to represent these different types of address
classes. */ classes. */
#define TYPE_ADDRESS_CLASS_1(t) (TYPE_INSTANCE_FLAGS(t) \ #define TYPE_ADDRESS_CLASS_1(t) (((t)->instance_flags ()) \
& TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1) & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
#define TYPE_ADDRESS_CLASS_2(t) (TYPE_INSTANCE_FLAGS(t) \ #define TYPE_ADDRESS_CLASS_2(t) (((t)->instance_flags ()) \
& TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2) & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
#define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \ #define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \
(TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2) (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
#define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \ #define TYPE_ADDRESS_CLASS_ALL(t) (((t)->instance_flags ()) \
& TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL) & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
/* * Information about a single discriminant. */ /* * Information about a single discriminant. */
@ -1684,7 +1684,6 @@ extern void allocate_gnat_aux_type (struct type *);
TYPE_ZALLOC (type, \ TYPE_ZALLOC (type, \
sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff))) sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
#define TYPE_INSTANCE_FLAGS(thistype) ((thistype)->instance_flags ())
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type #define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type

View File

@ -4473,12 +4473,11 @@ cleanup_undefined_types_1 (void)
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF if (SYMBOL_CLASS (sym) == LOC_TYPEDEF
&& SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
&& (SYMBOL_TYPE (sym)->code () == && (SYMBOL_TYPE (sym)->code () == (*type)->code ())
(*type)->code ()) && ((*type)->instance_flags ()
&& (TYPE_INSTANCE_FLAGS (*type) == == SYMBOL_TYPE (sym)->instance_flags ())
TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym)))
&& strcmp (sym->linkage_name (), type_name) == 0) && strcmp (sym->linkage_name (), type_name) == 0)
replace_type (*type, SYMBOL_TYPE (sym)); replace_type (*type, SYMBOL_TYPE (sym));
} }
} }
} }