From 9baccff6ae259e74ba1f172008a377dbe2107318 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 14 Sep 2020 11:08:03 -0400 Subject: [PATCH] gdb: add type::stub_is_supported / type::set_stub_is_supported Add the `stub_is_supported` and `set_stub_is_supported` methods on `struct type`, in order to remove the `TYPE_STUB_SUPPORTED` 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) : New methods. (TYPE_STUB_SUPPORTED): Use type::stub_is_supported, change all write call sites to use type::set_stub_is_supported. Change-Id: I4dfecf2b5df9c2b7bb8db1e9252082140adf3028 --- gdb/ChangeLog | 6 ++++++ gdb/dwarf2/read.c | 2 +- gdb/gdbtypes.h | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b8f2361b905..881429df6f1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-09-14 Simon Marchi + + * gdbtypes.h (struct type) : New methods. + (TYPE_STUB_SUPPORTED): Use type::stub_is_supported, change all write call sites to + use type::set_stub_is_supported. + 2020-09-14 Simon Marchi * gdbtypes.h (TYPE_VECTOR): Remove, replace all diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 45fdaf86375..410e4c8c677 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -16084,7 +16084,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) type->set_is_stub (true); } else - TYPE_STUB_SUPPORTED (type) = 1; + type->set_stub_is_supported (true); if (die_is_declaration (die, cu)) type->set_is_stub (true); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 4d567e42ab7..6f1bdfd49d6 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -233,7 +233,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only guessed the TYPE_STUB(t) value (see dwarfread.c). */ -#define TYPE_STUB_SUPPORTED(t) (TYPE_MAIN_TYPE (t)->flag_stub_supported) +#define TYPE_STUB_SUPPORTED(t) ((t)->stub_is_supported ()) /* * Not textual. By default, GDB treats all single byte integers as characters (or elements of strings) unless this flag is set. */ @@ -820,7 +820,7 @@ struct main_type unsigned int m_flag_prototyped : 1; unsigned int m_flag_varargs : 1; unsigned int m_flag_vector : 1; - unsigned int flag_stub_supported : 1; + unsigned int m_flag_stub_supported : 1; unsigned int flag_gnu_ifunc : 1; unsigned int flag_fixed_instance : 1; unsigned int flag_objfile_owned : 1; @@ -1125,6 +1125,16 @@ struct type this->main_type->m_flag_vector = is_vector; } + bool stub_is_supported () const + { + return this->main_type->m_flag_stub_supported; + } + + void set_stub_is_supported (bool stub_is_supported) + { + this->main_type->m_flag_stub_supported = stub_is_supported; + } + /* * 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; -- 2.30.2