diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-09-14 11:07:58 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-09-14 11:07:58 -0400 |
commit | b4b73759537ae830d8b48834b419b095561d4d4a (patch) | |
tree | 75c131b31fe269d8878e8fba12d2b58bfd668ac5 /gdb | |
parent | 20ce41238d912c3ced2870501f0c45cf7a03de92 (diff) | |
download | gdb-b4b73759537ae830d8b48834b419b095561d4d4a.zip gdb-b4b73759537ae830d8b48834b419b095561d4d4a.tar.gz gdb-b4b73759537ae830d8b48834b419b095561d4d4a.tar.bz2 |
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
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/ada-lang.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 10 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 4 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 14 | ||||
-rw-r--r-- | gdb/mdebugread.c | 4 | ||||
-rw-r--r-- | gdb/stabsread.c | 6 |
7 files changed, 31 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6d46d5e..1b58171 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 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 type::has_no_signedness. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c014d1c..c126f98 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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; diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 267cf0f..f17401e 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -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); } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 997bb09..687cfe0 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -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); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 0be0f5c..7739757 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 4fd3de1..735f008 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -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; } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 5f654e7..ce4c6f1 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1650,7 +1650,7 @@ again: 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); |