gdb: remove SYMBOL_TYPE macro

Add a getter and a setter for a symbol's type.  Remove the corresponding
macro and adjust all callers.

Change-Id: Ie1a137744c5bfe1df4d4f9ae5541c5299577c8de
This commit is contained in:
Simon Marchi 2022-01-27 22:16:41 -05:00
parent f5abd8f234
commit 5f9c5a63ce
57 changed files with 342 additions and 333 deletions

View file

@ -161,7 +161,7 @@ type_name_to_scope (const char *type_name, const struct block *block)
scope.push_back (comp);
if (SYMBOL_TYPE (bsymbol.symbol)->code () != TYPE_CODE_NAMESPACE)
if (bsymbol.symbol->type ()->code () != TYPE_CODE_NAMESPACE)
{
/* We're done. */
break;
@ -271,7 +271,7 @@ compile_cplus_instance::enter_scope (compile_scope &&new_scope)
(m_scopes.back ().begin (), m_scopes.back ().end () - 1,
[this] (const scope_component &comp)
{
gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code ()
gdb_assert (comp.bsymbol.symbol->type ()->code ()
== TYPE_CODE_NAMESPACE);
const char *ns = (comp.name == CP_ANONYMOUS_NAMESPACE_STR ? nullptr
@ -313,7 +313,7 @@ compile_cplus_instance::leave_scope ()
std::for_each
(current.begin (),current.end () - 1,
[this] (const scope_component &comp) {
gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code ()
gdb_assert (comp.bsymbol.symbol->type ()->code ()
== TYPE_CODE_NAMESPACE);
this->plugin ().pop_binding_level (comp.name.c_str ());
});
@ -345,14 +345,14 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type)
unqualified name of the type to process. */
scope_component &comp = scope.back ();
if (!types_equal (type, SYMBOL_TYPE (comp.bsymbol.symbol))
if (!types_equal (type, comp.bsymbol.symbol->type ())
&& (m_scopes.empty ()
|| (m_scopes.back ().back ().bsymbol.symbol
!= comp.bsymbol.symbol)))
{
/* The type is defined inside another class(es). Convert that
type instead of defining this type. */
convert_type (SYMBOL_TYPE (comp.bsymbol.symbol));
convert_type (comp.bsymbol.symbol->type ());
/* If the original type (passed in to us) is defined in a nested
class, the previous call will give us that type's gcc_type.