mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
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:
parent
20ce41238d
commit
b4b7375953
@ -1,3 +1,9 @@
|
||||
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* gdbtypes.h (TYPE_NOSIGN): Remove, replace all uses with
|
||||
|
@ -8604,7 +8604,7 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
|
||||
Consider the case of an array, for instance, where the size
|
||||
of the array is computed from the number of elements in
|
||||
our array multiplied by the size of its element. */
|
||||
TYPE_STUB (fixed_record_type) = 0;
|
||||
fixed_record_type->set_is_stub (false);
|
||||
}
|
||||
}
|
||||
return fixed_record_type;
|
||||
|
@ -16081,18 +16081,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
{
|
||||
/* ICC<14 does not output the required DW_AT_declaration on
|
||||
incomplete types, but gives them a size of zero. */
|
||||
TYPE_STUB (type) = 1;
|
||||
type->set_is_stub (true);
|
||||
}
|
||||
else
|
||||
TYPE_STUB_SUPPORTED (type) = 1;
|
||||
|
||||
if (die_is_declaration (die, cu))
|
||||
TYPE_STUB (type) = 1;
|
||||
type->set_is_stub (true);
|
||||
else if (attr == NULL && die->child == NULL
|
||||
&& producer_is_realview (cu->producer))
|
||||
/* RealView does not output the required DW_AT_declaration
|
||||
on incomplete types. */
|
||||
TYPE_STUB (type) = 1;
|
||||
type->set_is_stub (true);
|
||||
|
||||
/* We need to add the type field to the die immediately so we don't
|
||||
infinitely recurse when dealing with pointers to the structure
|
||||
@ -16631,7 +16631,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
Types. When another package uses such a type, an incomplete DIE
|
||||
may be generated by the compiler. */
|
||||
if (die_is_declaration (die, cu))
|
||||
TYPE_STUB (type) = 1;
|
||||
type->set_is_stub (true);
|
||||
|
||||
/* If this type has an underlying type that is not a stub, then we
|
||||
may use its attributes. We always use the "unsigned" attribute
|
||||
@ -18444,7 +18444,7 @@ read_unspecified_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
such a type, we treat it as a stub, and try to resolve it later on,
|
||||
when needed. */
|
||||
if (cu->language == language_ada)
|
||||
TYPE_STUB (type) = 1;
|
||||
type->set_is_stub (true);
|
||||
|
||||
return set_die_type (die, type, cu);
|
||||
}
|
||||
|
@ -867,7 +867,7 @@ allocate_stub_method (struct type *type)
|
||||
mtype = alloc_type_copy (type);
|
||||
mtype->set_code (TYPE_CODE_METHOD);
|
||||
TYPE_LENGTH (mtype) = 1;
|
||||
TYPE_STUB (mtype) = 1;
|
||||
mtype->set_is_stub (true);
|
||||
TYPE_TARGET_TYPE (mtype) = type;
|
||||
/* TYPE_SELF_TYPE (mtype) = unknown yet */
|
||||
return mtype;
|
||||
@ -3033,7 +3033,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
|
||||
We want a method (TYPE_CODE_METHOD). */
|
||||
smash_to_method_type (mtype, type, TYPE_TARGET_TYPE (mtype),
|
||||
argtypes, argcount, p[-2] == '.');
|
||||
TYPE_STUB (mtype) = 0;
|
||||
mtype->set_is_stub (false);
|
||||
TYPE_FN_FIELD_STUB (f, signature_id) = 0;
|
||||
|
||||
xfree (demangled_name);
|
||||
|
@ -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;
|
||||
|
@ -1086,7 +1086,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||
do not create a symbol for it either. */
|
||||
if (t->num_fields () == 0)
|
||||
{
|
||||
TYPE_STUB (t) = 1;
|
||||
t->set_is_stub (true);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4274,7 +4274,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
|
||||
{
|
||||
*pname = "<undefined>";
|
||||
*tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
||||
TYPE_STUB (*tpp) = 1;
|
||||
(*tpp)->set_is_stub (true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1650,7 +1650,7 @@ read_type (const char **pp, struct objfile *objfile)
|
||||
type->set_code (code);
|
||||
type->set_name (type_name);
|
||||
INIT_CPLUS_SPECIFIC (type);
|
||||
TYPE_STUB (type) = 1;
|
||||
type->set_is_stub (true);
|
||||
|
||||
add_undefined_type (type, typenums);
|
||||
return type;
|
||||
@ -3439,7 +3439,7 @@ read_struct_type (const char **pp, struct type *type, enum type_code type_code,
|
||||
|
||||
INIT_CPLUS_SPECIFIC (type);
|
||||
type->set_code (type_code);
|
||||
TYPE_STUB (type) = 0;
|
||||
type->set_is_stub (false);
|
||||
|
||||
/* First comes the total size in bytes. */
|
||||
|
||||
@ -3614,7 +3614,7 @@ read_enum_type (const char **pp, struct type *type,
|
||||
TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
|
||||
set_length_in_type_chain (type);
|
||||
type->set_code (TYPE_CODE_ENUM);
|
||||
TYPE_STUB (type) = 0;
|
||||
type->set_is_stub (false);
|
||||
if (unsigned_enum)
|
||||
type->set_is_unsigned (true);
|
||||
type->set_num_fields (nsyms);
|
||||
|
Loading…
Reference in New Issue
Block a user