gdb: remove TYPE_STUB

gdb/ChangeLog:

	* gdbtypes.h (TYPE_STUB): Remove, replace all
	uses with type::is_stub.

Change-Id: Iec25b50449a0d10a38f815209e478c343e98632c
This commit is contained in:
Simon Marchi 2020-09-14 11:07:59 -04:00
parent b4b7375953
commit e46d3488de
13 changed files with 31 additions and 28 deletions

View File

@ -1,3 +1,8 @@
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (TYPE_STUB): Remove, replace all
uses with type::is_stub.
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (struct type) <is_stub, set_is_stub>: New methods.

View File

@ -1592,7 +1592,7 @@ desc_bounds (struct value *arr)
{
struct type *target_type = TYPE_TARGET_TYPE (p_bounds_type);
if (TYPE_STUB (target_type))
if (target_type->is_stub ())
p_bounds = value_cast (lookup_pointer_type
(ada_check_typedef (target_type)),
p_bounds);
@ -5010,13 +5010,13 @@ remove_extra_symbols (std::vector<struct block_symbol> *syms)
/* If two symbols have the same name and one of them is a stub type,
the get rid of the stub. */
if (TYPE_STUB (SYMBOL_TYPE ((*syms)[i].symbol))
if (SYMBOL_TYPE ((*syms)[i].symbol)->is_stub ()
&& (*syms)[i].symbol->linkage_name () != NULL)
{
for (j = 0; j < syms->size (); j++)
{
if (j != i
&& !TYPE_STUB (SYMBOL_TYPE ((*syms)[j].symbol))
&& !SYMBOL_TYPE ((*syms)[j].symbol)->is_stub ()
&& (*syms)[j].symbol->linkage_name () != NULL
&& strcmp ((*syms)[i].symbol->linkage_name (),
(*syms)[j].symbol->linkage_name ()) == 0)
@ -8762,7 +8762,7 @@ ada_check_typedef (struct type *type)
type = check_typedef (type);
if (type == NULL || type->code () != TYPE_CODE_ENUM
|| !TYPE_STUB (type)
|| !type->is_stub ()
|| type->name () == NULL)
return type;
else

View File

@ -623,7 +623,7 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
flds = 0;
if (fld0 > fld1 && TYPE_STUB (type))
if (fld0 > fld1 && type->is_stub ())
return -1;
for (i = fld0; i <= fld1; i += 1)

View File

@ -1118,7 +1118,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
if (type->num_fields () == 0 && TYPE_NFN_FIELDS (type) == 0
&& TYPE_TYPEDEF_FIELD_COUNT (type) == 0)
{
if (TYPE_STUB (type))
if (type->is_stub ())
fprintfi_filtered (level + 4, stream,
_("%p[<incomplete type>%p]\n"),
metadata_style.style ().ptr (), nullptr);
@ -1629,7 +1629,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
fprintf_filtered (stream, "{\n");
if (type->num_fields () == 0)
{
if (TYPE_STUB (type))
if (type->is_stub ())
fprintfi_filtered (level + 4, stream,
_("%p[<incomplete type>%p]\n"),
metadata_style.style ().ptr (), nullptr);

View File

@ -16640,7 +16640,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
can tell us the reality. However, we defer to a local size
attribute if one exists, because this lets the compiler override
the underlying type if needed. */
if (TYPE_TARGET_TYPE (type) != NULL && !TYPE_STUB (TYPE_TARGET_TYPE (type)))
if (TYPE_TARGET_TYPE (type) != NULL && !TYPE_TARGET_TYPE (type)->is_stub ())
{
struct type *underlying_type = TYPE_TARGET_TYPE (type);
underlying_type = check_typedef (underlying_type);

View File

@ -934,7 +934,7 @@ create_range_type (struct type *result_type, struct type *index_type,
result_type = alloc_type_copy (index_type);
result_type->set_code (TYPE_CODE_RANGE);
TYPE_TARGET_TYPE (result_type) = index_type;
if (TYPE_STUB (index_type))
if (index_type->is_stub ())
TYPE_TARGET_STUB (result_type) = 1;
else
TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
@ -1388,7 +1388,7 @@ create_set_type (struct type *result_type, struct type *domain_type)
result_type->set_fields
((struct field *) TYPE_ZALLOC (result_type, sizeof (struct field)));
if (!TYPE_STUB (domain_type))
if (!domain_type->is_stub ())
{
LONGEST low_bound, high_bound, bit_length;
@ -2837,7 +2837,7 @@ check_typedef (struct type *type)
}
/* Otherwise, rely on the stub flag being set for opaque/stubbed
types. */
else if (TYPE_STUB (type) && !currently_reading_symtab)
else if (type->is_stub () && !currently_reading_symtab)
{
const char *name = type->name ();
/* FIXME: shouldn't we look in STRUCT_DOMAIN and/or VAR_DOMAIN
@ -2868,7 +2868,7 @@ check_typedef (struct type *type)
{
struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_STUB (target_type) || TYPE_TARGET_STUB (target_type))
if (target_type->is_stub () || TYPE_TARGET_STUB (target_type))
{
/* Nothing we can do. */
}
@ -5076,7 +5076,7 @@ recursive_dump_type (struct type *type, int spaces)
{
puts_filtered (" TYPE_ENDIANITY_NOT_DEFAULT");
}
if (TYPE_STUB (type))
if (type->is_stub ())
{
puts_filtered (" TYPE_STUB");
}

View File

@ -216,12 +216,6 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
#define TYPE_ENDIANITY_NOT_DEFAULT(t) (TYPE_MAIN_TYPE (t)->flag_endianity_not_default)
/* * This appears in a type's flags word if it is a stub type (e.g.,
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) ((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
arrays and ranges, in which TYPE_LENGTH of the array/range gets set
@ -1084,6 +1078,10 @@ struct type
this->main_type->m_flag_nosign = has_no_signedness;
}
/* This appears in a type's flags word if it is a stub type (e.g.,
if someone referenced a type that wasn't defined in a source file
via (struct sir_not_appearing_in_this_film *)). */
bool is_stub () const
{
return this->main_type->m_flag_stub;
@ -1841,7 +1839,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
&& ((thistype)->num_fields () == 0) \
&& (!HAVE_CPLUS_STRUCT (thistype) \
|| TYPE_NFN_FIELDS (thistype) == 0) \
&& (TYPE_STUB (thistype) || !TYPE_STUB_SUPPORTED (thistype)))
&& ((thistype)->is_stub () || !TYPE_STUB_SUPPORTED (thistype)))
/* * A helper macro that returns the name of a type or "unnamed type"
if the type has no name. */

View File

@ -383,7 +383,7 @@ m2_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
case TYPE_CODE_SET:
elttype = type->index_type ();
elttype = check_typedef (elttype);
if (TYPE_STUB (elttype))
if (elttype->is_stub ())
{
fprintf_styled (stream, metadata_style.style (),
_("<incomplete type>"));

View File

@ -561,7 +561,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
fprintf_filtered (stream, "\n");
if ((type->num_fields () == 0) && (TYPE_NFN_FIELDS (type) == 0))
{
if (TYPE_STUB (type))
if (type->is_stub ())
fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
else
fprintfi_filtered (level + 4, stream, "<no data fields>\n");

View File

@ -330,7 +330,7 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream,
case TYPE_CODE_SET:
elttype = type->index_type ();
elttype = check_typedef (elttype);
if (TYPE_STUB (elttype))
if (elttype->is_stub ())
{
fprintf_styled (stream, metadata_style.style (), "<incomplete type>");
break;

View File

@ -1363,7 +1363,7 @@ type_to_type_object (struct type *type)
try
{
/* Try not to let stub types leak out to Python. */
if (TYPE_STUB (type))
if (type->is_stub ())
type = check_typedef (type);
}
catch (...)

View File

@ -2336,7 +2336,7 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
== TYPE_CODE_METHOD);
/* If this is just a stub, then we don't have the real name here. */
if (TYPE_STUB (new_sublist->fn_field.type))
if (new_sublist->fn_field.type->is_stub ())
{
if (!TYPE_SELF_TYPE (new_sublist->fn_field.type))
set_type_self_type (new_sublist->fn_field.type, type);
@ -3429,7 +3429,7 @@ read_struct_type (const char **pp, struct type *type, enum type_code type_code,
scribbling on existing structure type objects when new definitions
appear. */
if (! (type->code () == TYPE_CODE_UNDEF
|| TYPE_STUB (type)))
|| type->is_stub ()))
{
complain_about_struct_wipeout (type);
@ -4453,7 +4453,7 @@ cleanup_undefined_types_1 (void)
as well as in check_typedef to deal with the (legitimate in
C though not C++) case of several types with the same name
in different source files. */
if (TYPE_STUB (*type))
if ((*type)->is_stub ())
{
struct pending *ppt;
int i;

View File

@ -947,7 +947,7 @@ do_val_print (struct value *value, struct ui_file *stream, int recurse,
only a stub and we can't find and substitute its complete type, then
print appropriate string and return. */
if (TYPE_STUB (real_type))
if (real_type->is_stub ())
{
fprintf_styled (stream, metadata_style.style (), _("<incomplete type>"));
return;