summaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2022-01-27 22:16:41 -0500
committerSimon Marchi <simon.marchi@efficios.com>2022-02-06 16:03:47 -0500
commit5f9c5a63ce38b103f778f54394c6a3d43b7ade90 (patch)
treec356fc03c61b9e9234aa8e187fb6c2303b8e5d2c /gdb/compile
parentf5abd8f234426bbe8ccd08c43e6ae7cbe635e042 (diff)
downloadbinutils-gdb-5f9c5a63ce38b103f778f54394c6a3d43b7ade90.tar.gz
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
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile-c-symbols.c12
-rw-r--r--gdb/compile/compile-cplus-symbols.c14
-rw-r--r--gdb/compile/compile-cplus-types.c10
-rw-r--r--gdb/compile/compile-object-load.c8
-rw-r--r--gdb/compile/compile-object-run.c2
5 files changed, 23 insertions, 23 deletions
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 41746c20e05..4f7a5b22da5 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -65,7 +65,7 @@ convert_one_symbol (compile_c_instance *context,
if (sym.symbol->aclass () == LOC_LABEL)
sym_type = 0;
else
- sym_type = context->convert_type (SYMBOL_TYPE (sym.symbol));
+ sym_type = context->convert_type (sym.symbol->type ());
if (sym.symbol->domain () == STRUCT_DOMAIN)
{
@@ -94,12 +94,12 @@ convert_one_symbol (compile_c_instance *context,
case LOC_BLOCK:
kind = GCC_C_SYMBOL_FUNCTION;
addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym.symbol));
- if (is_global && SYMBOL_TYPE (sym.symbol)->is_gnu_ifunc ())
+ if (is_global && sym.symbol->type ()->is_gnu_ifunc ())
addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
break;
case LOC_CONST:
- if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM)
+ if (sym.symbol->type ()->code () == TYPE_CODE_ENUM)
{
/* Already handled by convert_enum. */
return;
@@ -405,7 +405,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
"gcc_symbol_address \"%s\": full symbol\n",
identifier);
result = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
- if (SYMBOL_TYPE (sym)->is_gnu_ifunc ())
+ if (sym->type ()->is_gnu_ifunc ())
result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
found = 1;
}
@@ -548,14 +548,14 @@ generate_c_for_for_one_variable (compile_instance *compiler,
try
{
- if (is_dynamic_type (SYMBOL_TYPE (sym)))
+ if (is_dynamic_type (sym->type ()))
{
/* We need to emit to a temporary buffer in case an error
occurs in the middle. */
string_file local_file;
generate_vla_size (compiler, &local_file, gdbarch, registers_used, pc,
- SYMBOL_TYPE (sym), sym);
+ sym->type (), sym);
stream->write (local_file.c_str (), local_file.size ());
}
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index 3a24aa7dc8b..7cf5703dc71 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -56,7 +56,7 @@ convert_one_symbol (compile_cplus_instance *instance,
if (sym.symbol->aclass () == LOC_LABEL)
sym_type = 0;
else
- sym_type = instance->convert_type (SYMBOL_TYPE (sym.symbol));
+ sym_type = instance->convert_type (sym.symbol->type ());
if (sym.symbol->domain () == STRUCT_DOMAIN)
{
@@ -73,9 +73,9 @@ convert_one_symbol (compile_cplus_instance *instance,
switch (sym.symbol->aclass ())
{
case LOC_TYPEDEF:
- if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_TYPEDEF)
+ if (sym.symbol->type ()->code () == TYPE_CODE_TYPEDEF)
kind = GCC_CP_SYMBOL_TYPEDEF;
- else if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_NAMESPACE)
+ else if (sym.symbol->type ()->code () == TYPE_CODE_NAMESPACE)
return;
break;
@@ -88,13 +88,13 @@ convert_one_symbol (compile_cplus_instance *instance,
{
kind = GCC_CP_SYMBOL_FUNCTION;
addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym.symbol));
- if (is_global && SYMBOL_TYPE (sym.symbol)->is_gnu_ifunc ())
+ if (is_global && sym.symbol->type ()->is_gnu_ifunc ())
addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
}
break;
case LOC_CONST:
- if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM)
+ if (sym.symbol->type ()->code () == TYPE_CODE_ENUM)
{
/* Already handled by convert_enum. */
return;
@@ -190,7 +190,7 @@ convert_one_symbol (compile_cplus_instance *instance,
{
compile_scope scope
= instance->new_scope (sym.symbol->natural_name (),
- SYMBOL_TYPE (sym.symbol));
+ sym.symbol->type ());
if (scope.nested_type () != GCC_TYPE_NONE)
{
/* We found a symbol for this type that was defined inside
@@ -442,7 +442,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
"gcc_symbol_address \"%s\": full symbol\n",
identifier);
result = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
- if (SYMBOL_TYPE (sym)->is_gnu_ifunc ())
+ if (sym->type ()->is_gnu_ifunc ())
result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
found = 1;
}
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index ce8b9452685..19879966986 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -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.
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 692e9906fd7..073f2fe2fd3 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -458,7 +458,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
if (block_loop == nblocks)
error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_VAL);
- gdb_type = SYMBOL_TYPE (gdb_val_sym);
+ gdb_type = gdb_val_sym->type ();
gdb_type = check_typedef (gdb_type);
gdb_ptr_type_sym = block_lookup_symbol (block, COMPILE_I_EXPR_PTR_TYPE,
@@ -466,7 +466,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
VAR_DOMAIN);
if (gdb_ptr_type_sym == NULL)
error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
- gdb_ptr_type = SYMBOL_TYPE (gdb_ptr_type_sym);
+ gdb_ptr_type = gdb_ptr_type_sym->type ();
gdb_ptr_type = check_typedef (gdb_ptr_type);
if (gdb_ptr_type->code () != TYPE_CODE_PTR)
error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE);
@@ -517,7 +517,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
static struct type *
get_regs_type (struct symbol *func_sym, struct objfile *objfile)
{
- struct type *func_type = SYMBOL_TYPE (func_sym);
+ struct type *func_type = func_sym->type ();
struct type *regsp_type, *regs_type;
/* No register parameter present. */
@@ -656,7 +656,7 @@ compile_object_load (const compile_file_names &file_names,
if (func_sym == NULL)
error (_("Cannot find function \"%s\" in compiled module \"%s\"."),
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
- func_type = SYMBOL_TYPE (func_sym);
+ func_type = func_sym->type ();
if (func_type->code () != TYPE_CODE_FUNC)
error (_("Invalid type code %d of function \"%s\" in compiled "
"module \"%s\"."),
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index b2e09cab071..bce0f82a1ee 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -134,7 +134,7 @@ compile_object_run (compile_module_up &&module)
try
{
- struct type *func_type = SYMBOL_TYPE (func_sym);
+ struct type *func_type = func_sym->type ();
int current_arg = 0;
struct value **vargs;