switch (syms[i].symbol->aclass ())
{
case LOC_TYPEDEF:
- if (ada_prefer_type (SYMBOL_TYPE (syms[i].symbol), preferred_type))
+ if (ada_prefer_type (syms[i].symbol->type (), preferred_type))
{
preferred_index = i;
- preferred_type = SYMBOL_TYPE (syms[i].symbol);
+ preferred_type = syms[i].symbol->type ();
}
break;
case LOC_REGISTER:
strcat (expanded_name, name);
sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN).symbol;
if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
- type = SYMBOL_TYPE (sym);
+ type = sym->type ();
}
return type;
{
const char *field_name = encoded_field_name;
const char *subfield_name;
- struct type *type = SYMBOL_TYPE (sym);
+ struct type *type = sym->type ();
int fieldno;
if (type == NULL || field_name == NULL)
struct type *field_type;
if (tail_index == name_len)
- return SYMBOL_TYPE (type_sym);
+ return type_sym->type ();
/* We have some extraneous characters after the type name.
If this is an expression "TYPE_NAME.FIELD0.[...].FIELDN",
ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
const struct type_print_options *flags)
{
- struct type *type = SYMBOL_TYPE (sym);
+ struct type *type = sym->type ();
fprintf_filtered (stream, "%s", sym->print_name ());
if (!print_signatures
{
int is_enumeral =
(syms[i].symbol->aclass () == LOC_CONST
- && SYMBOL_TYPE (syms[i].symbol) != NULL
- && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM);
+ && syms[i].symbol->type () != NULL
+ && syms[i].symbol->type ()->code () == TYPE_CODE_ENUM);
struct symtab *symtab = NULL;
if (syms[i].symbol->is_objfile_owned ())
SYMBOL_LINE (syms[i].symbol));
}
else if (is_enumeral
- && SYMBOL_TYPE (syms[i].symbol)->name () != NULL)
+ && syms[i].symbol->type ()->name () != NULL)
{
printf_filtered (("[%d] "), i + first_choice);
- ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL,
+ ada_print_type (syms[i].symbol->type (), NULL,
gdb_stdout, -1, 0, &type_print_raw_options);
printf_filtered (_("'(%s) (enumeral)\n"),
syms[i].symbol->print_name ());
{
/* We already know the name matches, so we're just looking for
an element of the correct enum type. */
- if (ada_check_typedef (SYMBOL_TYPE (syms[i].symbol)) == context_type)
+ if (ada_check_typedef (syms[i].symbol->type ()) == context_type)
return i;
}
ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
{
int i;
- struct type *func_type = SYMBOL_TYPE (func);
+ struct type *func_type = func->type ();
if (func->aclass () == LOC_CONST
&& func_type->code () == TYPE_CODE_ENUM)
{
for (k = 0; k < syms.size (); k += 1)
{
- struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].symbol));
+ struct type *type = ada_check_typedef (syms[k].symbol->type ());
if (ada_args_match (syms[k].symbol, args, nargs)
&& (fallback || return_match (type, context_type)))
is_nonfunction (const std::vector<struct block_symbol> &syms)
{
for (const block_symbol &sym : syms)
- if (SYMBOL_TYPE (sym.symbol)->code () != TYPE_CODE_FUNC
- && (SYMBOL_TYPE (sym.symbol)->code () != TYPE_CODE_ENUM
+ if (sym.symbol->type ()->code () != TYPE_CODE_FUNC
+ && (sym.symbol->type ()->code () != TYPE_CODE_ENUM
|| sym.symbol->aclass () != LOC_CONST))
return 1;
return 1;
case LOC_TYPEDEF:
{
- struct type *type0 = SYMBOL_TYPE (sym0);
- struct type *type1 = SYMBOL_TYPE (sym1);
+ struct type *type0 = sym0->type ();
+ struct type *type1 = sym1->type ();
const char *name0 = sym0->linkage_name ();
const char *name1 = sym1->linkage_name ();
int len0 = strlen (name0);
}
case LOC_CONST:
return SYMBOL_VALUE (sym0) == SYMBOL_VALUE (sym1)
- && equiv_types (SYMBOL_TYPE (sym0), SYMBOL_TYPE (sym1));
+ && equiv_types (sym0->type (), sym1->type ());
case LOC_STATIC:
{
/* Quick check: All symbols should have an enum type. */
for (i = 0; i < syms.size (); i++)
- if (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM)
+ if (syms[i].symbol->type ()->code () != TYPE_CODE_ENUM)
return 0;
/* Quick check: They should all have the same value. */
/* Quick check: They should all have the same number of enumerals. */
for (i = 1; i < syms.size (); i++)
- if (SYMBOL_TYPE (syms[i].symbol)->num_fields ()
- != SYMBOL_TYPE (syms[0].symbol)->num_fields ())
+ if (syms[i].symbol->type ()->num_fields ()
+ != syms[0].symbol->type ()->num_fields ())
return 0;
/* All the sanity checks passed, so we might have a set of
identical enumeration types. Perform a more complete
comparison of the type of each symbol. */
for (i = 1; i < syms.size (); i++)
- if (!ada_identical_enum_types_p (SYMBOL_TYPE (syms[i].symbol),
- SYMBOL_TYPE (syms[0].symbol)))
+ if (!ada_identical_enum_types_p (syms[i].symbol->type (),
+ syms[0].symbol->type ()))
return 0;
return 1;
/* If two symbols have the same name and one of them is a stub type,
the get rid of the stub. */
- if (SYMBOL_TYPE ((*syms)[i].symbol)->is_stub ()
+ if ((*syms)[i].symbol->type ()->is_stub ()
&& (*syms)[i].symbol->linkage_name () != NULL)
{
for (j = 0; j < syms->size (); j++)
{
if (j != i
- && !SYMBOL_TYPE ((*syms)[j].symbol)->is_stub ()
+ && !(*syms)[j].symbol->type ()->is_stub ()
&& (*syms)[j].symbol->linkage_name () != NULL
&& strcmp ((*syms)[i].symbol->linkage_name (),
(*syms)[j].symbol->linkage_name ()) == 0)
else if ((*syms)[i].symbol->linkage_name () != NULL
&& (*syms)[i].symbol->aclass () == LOC_STATIC
- && is_nondebugging_type (SYMBOL_TYPE ((*syms)[i].symbol)))
+ && is_nondebugging_type ((*syms)[i].symbol->type ()))
{
for (j = 0; j < syms->size (); j += 1)
{
if (sym->aclass () != LOC_TYPEDEF)
return 0;
- std::string scope = xget_renaming_scope (SYMBOL_TYPE (sym));
+ std::string scope = xget_renaming_scope (sym->type ());
/* If the rename has been defined in a package, then it is visible. */
if (is_package_name (scope.c_str ()))
struct symbol *sym = ada_find_any_type_symbol (name);
if (sym != NULL)
- return SYMBOL_TYPE (sym);
+ return sym->type ();
return NULL;
}
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
- struct type *type = static_unwrap_type (SYMBOL_TYPE (sym));
+ struct type *type = static_unwrap_type (sym->type ());
/* Check to see if this is a tagged type. We also need to handle
the case where the type is a reference to a tagged type, but
we have to be careful to exclude pointers to tagged types.
}
if (deprocedure_p
- && (SYMBOL_TYPE (std::get<0> (m_storage).symbol)->code ()
+ && (std::get<0> (m_storage).symbol->type ()->code ()
== TYPE_CODE_FUNC))
return true;
static int
ada_is_exception_sym (struct symbol *sym)
{
- const char *type_name = SYMBOL_TYPE (sym)->name ();
+ const char *type_name = sym->type ()->name ();
return (sym->aclass () != LOC_TYPEDEF
&& sym->aclass () != LOC_BLOCK
lookup_symbol_in_language (entry_call_record_name, NULL, STRUCT_DOMAIN,
language_c, NULL).symbol;
- if (atcb_sym == NULL || atcb_sym->type == NULL)
+ if (atcb_sym == NULL || atcb_sym->type () == NULL)
{
/* In Ravenscar run-time libs, the ATCB does not have a dynamic
size, so the symbol name differs. */
STRUCT_DOMAIN, language_c,
NULL).symbol;
- if (atcb_sym == NULL || atcb_sym->type == NULL)
+ if (atcb_sym == NULL || atcb_sym->type () == NULL)
return _("Cannot find Ada_Task_Control_Block type");
- type = atcb_sym->type;
+ type = atcb_sym->type ();
}
else
{
/* Get a static representation of the type record
Ada_Task_Control_Block. */
- type = atcb_sym->type;
+ type = atcb_sym->type ();
type = ada_template_to_fixed_record_type_1 (type, NULL, 0, NULL, 0);
}
- if (common_atcb_sym == NULL || common_atcb_sym->type == NULL)
+ if (common_atcb_sym == NULL || common_atcb_sym->type () == NULL)
return _("Cannot find Common_ATCB type");
- if (private_data_sym == NULL || private_data_sym->type == NULL)
+ if (private_data_sym == NULL || private_data_sym->type ()== NULL)
return _("Cannot find Private_Data type");
- if (entry_call_record_sym == NULL || entry_call_record_sym->type == NULL)
+ if (entry_call_record_sym == NULL || entry_call_record_sym->type () == NULL)
return _("Cannot find Entry_Call_Record type");
/* Get the type for Ada_Task_Control_Block.Common. */
- common_type = common_atcb_sym->type;
+ common_type = common_atcb_sym->type ();
/* Get the type for Ada_Task_Control_Bloc.Common.Call.LL. */
- ll_type = private_data_sym->type;
+ ll_type = private_data_sym->type ();
/* Get the type for Common_ATCB.Call.all. */
- call_type = entry_call_record_sym->type;
+ call_type = entry_call_record_sym->type ();
/* Get the field indices. */
fieldnos.common = ada_get_field_index (type, "common", 0);
if (sym != NULL)
{
/* Validate. */
- struct type *type = check_typedef (SYMBOL_TYPE (sym));
+ struct type *type = check_typedef (sym->type ());
struct type *eltype = NULL;
struct type *idxtype = NULL;
if (sym != NULL && SYMBOL_VALUE_ADDRESS (sym) != 0)
{
/* Validate. */
- struct type *type = check_typedef (SYMBOL_TYPE (sym));
+ struct type *type = check_typedef (sym->type ());
if (type->code () == TYPE_CODE_PTR)
{
gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
{
/* Dereference any typedefs. */
- value->type = check_typedef (SYMBOL_TYPE (var));
+ value->type = check_typedef (var->type ());
value->optimized_out = 0;
if (SYMBOL_COMPUTED_OPS (var) != NULL)
int
block_find_non_opaque_type (struct symbol *sym, void *data)
{
- return !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym));
+ return !TYPE_IS_OPAQUE (sym->type ());
}
/* See block.h. */
{
struct symbol **best = (struct symbol **) data;
- if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
+ if (!TYPE_IS_OPAQUE (sym->type ()))
return 1;
*best = sym;
return 0;
struct symbol *sym = find_pc_function (pc);
if (sym != NULL && BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) == pc)
- return SYMBOL_TYPE (sym);
+ return sym->type ();
return NULL;
}
if (symbol)
{
- struct type *ftype = SYMBOL_TYPE (symbol);
+ struct type *ftype = symbol->type ();
struct mdict_iterator miter;
SYMBOL_BLOCK_VALUE (symbol) = block;
BLOCK_FUNCTION (block) = symbol;
if (sym->is_argument ())
{
- ftype->field (iparams).set_type (SYMBOL_TYPE (sym));
+ ftype->field (iparams).set_type (sym->type ());
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
iparams++;
}
&inner_is_a_field_of_this);
if (bsym.symbol != NULL)
{
- yylval.tsym.type = SYMBOL_TYPE (bsym.symbol);
+ yylval.tsym.type = bsym.symbol->type ();
return TYPENAME;
}
}
if (bsym.symbol && bsym.symbol->aclass () == LOC_TYPEDEF)
{
- yylval.tsym.type = SYMBOL_TYPE (bsym.symbol);
+ yylval.tsym.type = bsym.symbol->type ();
return TYPENAME;
}
sym = lookup_struct_typedef (copy.c_str (),
par_state->expression_context_block, 1);
if (sym)
- yylval.theclass.type = SYMBOL_TYPE (sym);
+ yylval.theclass.type = sym->type ();
return CLASSNAME;
}
}
return ERROR;
case LOC_TYPEDEF:
- yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol);
+ yylval.tsym.type = yylval.ssym.sym.symbol->type ();
return TYPENAME;
default:
type = check_typedef (type);
fprintf_filtered (stream, "typedef ");
type_print (type, "", stream, -1);
- if ((SYMBOL_TYPE (new_symbol))->name () == 0
- || strcmp ((SYMBOL_TYPE (new_symbol))->name (),
+ if ((new_symbol->type ())->name () == 0
+ || strcmp ((new_symbol->type ())->name (),
new_symbol->linkage_name ()) != 0
- || SYMBOL_TYPE (new_symbol)->code () == TYPE_CODE_TYPEDEF)
+ || new_symbol->type ()->code () == TYPE_CODE_TYPEDEF)
fprintf_filtered (stream, " %s", new_symbol->print_name ());
fprintf_filtered (stream, ";");
}
fprintf_filtered (stream, "%s = ", sym->linkage_name ());
}
- c_print_type (SYMBOL_TYPE (sym), "", stream, -1, 0, flags);
+ c_print_type (sym->type (), "", stream, -1, 0, flags);
}
if (!first)
if (wsym)
{
- wtype = SYMBOL_TYPE (wsym);
+ wtype = wsym->type ();
}
else
{
from different files with the same name. */
if (real_sym->aclass () == LOC_TYPEDEF
&& real_sym->domain () == VAR_DOMAIN
- && SYMBOL_TYPE (real_sym)->code () == TYPE_CODE_PTR
- && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (real_sym))) != 0)
+ && real_sym->type ()->code () == TYPE_CODE_PTR
+ && TYPE_LENGTH (TYPE_TARGET_TYPE (real_sym->type ())) != 0)
{
const char *name = real_sym->linkage_name ();
int hash = hashname (name);
opaque_type_chain[hash] = SYMBOL_VALUE_CHAIN (sym);
}
- patch_type (SYMBOL_TYPE (sym), SYMBOL_TYPE (real_sym));
+ patch_type (sym->type (), real_sym->type ());
if (prev)
{
if (ISFCN (cs->c_type))
{
SYMBOL_VALUE (sym) += objfile->text_section_offset ();
- SYMBOL_TYPE (sym) =
- lookup_function_type (decode_function_type (cs, cs->c_type,
- aux, objfile));
+ sym->set_type
+ (lookup_function_type (decode_function_type (cs, cs->c_type,
+ aux, objfile)));
sym->set_aclass_index (LOC_BLOCK);
if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT
}
else
{
- SYMBOL_TYPE (sym) = decode_type (cs, cs->c_type, aux, objfile);
+ sym->set_type (decode_type (cs, cs->c_type, aux, objfile));
switch (cs->c_sclass)
{
case C_NULL:
sym->set_domain (VAR_DOMAIN);
/* If type has no name, give it one. */
- if (SYMBOL_TYPE (sym)->name () == 0)
+ if (sym->type ()->name () == 0)
{
- if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
- || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC)
+ if (sym->type ()->code () == TYPE_CODE_PTR
+ || sym->type ()->code () == TYPE_CODE_FUNC)
{
/* If we are giving a name to a type such as
"pointer to foo" or "function returning foo", we
;
}
else
- SYMBOL_TYPE (sym)->set_name (xstrdup (sym->linkage_name ()));
+ sym->type ()->set_name (xstrdup (sym->linkage_name ()));
}
/* Keep track of any type which points to empty structured
not an empty structured type, though; the forward
references work themselves out via the magic of
coff_lookup_type. */
- if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
- && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) == 0
- && TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))->code ()
+ if (sym->type ()->code () == TYPE_CODE_PTR
+ && TYPE_LENGTH (TYPE_TARGET_TYPE (sym->type ())) == 0
+ && TYPE_TARGET_TYPE (sym->type ())->code ()
!= TYPE_CODE_UNDEF)
{
int i = hashname (sym->linkage_name ());
/* Some compilers try to be helpful by inventing "fake"
names for anonymous enums, structures, and unions, like
"~0fake" or ".0fake". Thanks, but no thanks... */
- if (SYMBOL_TYPE (sym)->name () == 0)
+ if (sym->type ()->name () == 0)
if (sym->linkage_name () != NULL
&& *sym->linkage_name () != '~'
&& *sym->linkage_name () != '.')
- SYMBOL_TYPE (sym)->set_name (xstrdup (sym->linkage_name ()));
+ sym->type ()->set_name (xstrdup (sym->linkage_name ()));
add_symbol_to_list (sym, get_file_symbols ());
break;
{
struct symbol *xsym = syms->symbol[j];
- SYMBOL_TYPE (xsym) = type;
+ xsym->set_type (type);
type->field (n).set_name (xsym->linkage_name ());
type->field (n).set_loc_enumval (SYMBOL_VALUE (xsym));
if (SYMBOL_VALUE (xsym) < 0)
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)
{
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;
"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;
}
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 ());
}
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)
{
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;
{
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;
{
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
"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;
}
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;
(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
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 ());
});
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.
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,
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);
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. */
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\"."),
try
{
- struct type *func_type = SYMBOL_TYPE (func_sym);
+ struct type *func_type = func_sym->type ();
int current_arg = 0;
struct value **vargs;
return {};
- type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol)));
+ type = check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ()));
/* If TYPE_NAME is NULL, abandon trying to find this symbol.
This can happen for lambda functions compiled with clang++,
which outputs no name for the container class. */
if (scope_sym.symbol == NULL)
return {};
- struct type *scope_type = SYMBOL_TYPE (scope_sym.symbol);
+ struct type *scope_type = scope_sym.symbol->type ();
/* If the scope is a function/method, then look up NESTED as a local
static variable. E.g., "print 'function()::static_var'". */
if (sym != NULL)
{
- struct type *otype = SYMBOL_TYPE (sym);
+ struct type *otype = sym->type ();
if (finder != NULL)
{
if (sym != NULL)
{
- struct type *otype = SYMBOL_TYPE (sym);
+ struct type *otype = sym->type ();
const char *new_name = (*finder) (otype, data);
if (new_name != NULL)
{
/* If there is no type information, we can't do anything, so
skip. */
- if (SYMBOL_TYPE (sym) == NULL)
+ if (sym->type () == NULL)
return;
/* skip any symbols that we've already considered. */
return NULL;
}
- rtti_type = check_typedef (SYMBOL_TYPE (rtti_sym));
+ rtti_type = check_typedef (rtti_sym->type ());
switch (rtti_type->code ())
{
sym->compute_and_set_names (name, false, ccp->of->per_bfd);
sym->set_aclass_index (LOC_CONST);
sym->set_domain (VAR_DOMAIN);
- SYMBOL_TYPE (sym) = fip->ptype;
+ sym->set_type (fip->ptype);
add_symbol_to_list (sym, ccp->builder->get_global_symbols ());
}
sym->set_aclass_index (LOC_OPTIMIZED_OUT);
if (type != nullptr)
- SYMBOL_TYPE (sym) = type;
+ sym->set_type (type);
uint32_t kind = ctf_type_kind (fp, tid);
switch (kind)
set_symbol_address (objfile, sym, sym->linkage_name ());
break;
case CTF_K_CONST:
- if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID)
- SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int;
+ if (sym->type ()->code () == TYPE_CODE_VOID)
+ sym->set_type (objfile_type (objfile)->builtin_int);
break;
case CTF_K_TYPEDEF:
case CTF_K_INTEGER:
}
sym = new (&ccp->of->objfile_obstack) symbol;
OBJSTAT (ccp->of, n_syms++);
- SYMBOL_TYPE (sym) = type;
+ sym->set_type (type);
sym->set_domain (VAR_DOMAIN);
sym->set_aclass_index (LOC_OPTIMIZED_OUT);
sym->compute_and_set_names (name, false, ccp->of->per_bfd);
continue;
sym = new (&ccp->of->objfile_obstack) symbol;
OBJSTAT (ccp->of, n_syms++);
- SYMBOL_TYPE (sym) = type;
+ sym->set_type (type);
sym->set_domain (VAR_DOMAIN);
sym->set_aclass_index (LOC_STATIC);
sym->compute_and_set_names (tname, false, ccp->of->per_bfd);
sym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN, &is_a_field_of_this);
if (sym.symbol && sym.symbol->aclass () == LOC_TYPEDEF)
{
- yylval.tsym.type = SYMBOL_TYPE (sym.symbol);
+ yylval.tsym.type = sym.symbol->type ();
return TYPENAME;
}
else if (sym.symbol == NULL)
if (sym.symbol != NULL)
{
- yylval.tsym.type = SYMBOL_TYPE (sym.symbol);
+ yylval.tsym.type = sym.symbol->type ();
return TYPENAME;
}
if (yylval.ssym.sym.symbol->aclass () == LOC_TYPEDEF)
{
- yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol);
+ yylval.tsym.type = yylval.ssym.sym.symbol->type ();
return TYPENAME;
}
if (lang_this.symbol == NULL)
return {};
- type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol)));
+ type = check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ()));
classname = type->name ();
nested = name;
}
return {};
/* Look for a symbol named NESTED in this class. */
- sym = d_lookup_nested_symbol (SYMBOL_TYPE (class_sym.symbol),
+ sym = d_lookup_nested_symbol (class_sym.symbol->type (),
nested.c_str (), block);
}
"name for address %s"),
paddress (gdbarch, addr));
- type = SYMBOL_TYPE (sym);
+ type = sym->type ();
gdb_assert (type->code () == TYPE_CODE_FUNC);
gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
func_sym = func_addr_to_tail_call_list (gdbarch, addr);
- for (call_site = TYPE_TAIL_CALL_LIST (SYMBOL_TYPE (func_sym));
+ for (call_site = TYPE_TAIL_CALL_LIST (func_sym->type ());
call_site; call_site = call_site->tail_call_next)
{
CORE_ADDR target_addr;
struct symbol *target_func;
target_func = func_addr_to_tail_call_list (gdbarch, target_func_addr);
- target_call_site = TYPE_TAIL_CALL_LIST (SYMBOL_TYPE (target_func));
+ target_call_site = TYPE_TAIL_CALL_LIST (target_func->type ());
}
do
= (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (symbol);
struct value *val;
- val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data,
+ val = dwarf2_evaluate_loc_desc (symbol->type (), frame, dlbaton->data,
dlbaton->size, dlbaton->per_cu,
dlbaton->per_objfile);
struct dwarf2_locexpr_baton *dlbaton
= (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (symbol);
- return value_of_dwarf_block_entry (SYMBOL_TYPE (symbol), frame, dlbaton->data,
+ return value_of_dwarf_block_entry (symbol->type (), frame, dlbaton->data,
dlbaton->size);
}
CORE_ADDR pc = frame ? get_frame_address_in_block (frame) : 0;
data = dwarf2_find_location_expression (dlbaton, &size, pc);
- val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size,
+ val = dwarf2_evaluate_loc_desc (symbol->type (), frame, data, size,
dlbaton->per_cu, dlbaton->per_objfile);
return val;
CORE_ADDR pc;
if (frame == NULL || !get_frame_func_if_available (frame, &pc))
- return allocate_optimized_out_value (SYMBOL_TYPE (symbol));
+ return allocate_optimized_out_value (symbol->type ());
data = dwarf2_find_location_expression (dlbaton, &size, pc);
if (data == NULL)
- return allocate_optimized_out_value (SYMBOL_TYPE (symbol));
+ return allocate_optimized_out_value (symbol->type ());
- return value_of_dwarf_block_entry (SYMBOL_TYPE (symbol), frame, data, size);
+ return value_of_dwarf_block_entry (symbol->type (), frame, data, size);
}
/* Implementation of get_symbol_read_needs from
e.g., "main" finds the "main" module and not C's main(). */
sym->set_domain (STRUCT_DOMAIN);
sym->set_aclass_index (LOC_TYPEDEF);
- SYMBOL_TYPE (sym) = type;
+ sym->set_type (type);
add_symbol_to_list (sym, cu->get_builder ()->get_global_symbols ());
}
sym->set_domain (VAR_DOMAIN);
sym->set_aclass_index (LOC_OPTIMIZED_OUT);
if (type != NULL)
- SYMBOL_TYPE (sym) = type;
+ sym->set_type (type);
else
- SYMBOL_TYPE (sym) = die_type (die, cu);
+ sym->set_type (die_type (die, cu));
attr = dwarf2_attr (die,
inlined_func ? DW_AT_call_line : DW_AT_decl_line,
cu);
}
else
sym->set_aclass_index (LOC_OPTIMIZED_OUT);
- SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_core_addr;
+ sym->set_type (objfile_type (objfile)->builtin_core_addr);
sym->set_domain (LABEL_DOMAIN);
add_symbol_to_list (sym, cu->list_in_scope);
break;
/* Compilation with minimal debug info may result in
variables with missing type entries. Change the
misleading `void' type to something sensible. */
- if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID)
- SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int;
+ if (sym->type ()->code () == TYPE_CODE_VOID)
+ sym->set_type (objfile_type (objfile)->builtin_int);
attr = dwarf2_attr (die, DW_AT_const_value, cu);
/* In the case of DW_TAG_member, we should only be called for
/* The symbol's name is already allocated along
with this objfile, so we don't need to
duplicate it for the type. */
- if (SYMBOL_TYPE (sym)->name () == 0)
- SYMBOL_TYPE (sym)->set_name (sym->search_name ());
+ if (sym->type ()->name () == 0)
+ sym->type ()->set_name (sym->search_name ());
}
}
}
const gdb_byte *bytes;
struct dwarf2_locexpr_baton *baton;
- dwarf2_const_value_attr (attr, SYMBOL_TYPE (sym),
+ dwarf2_const_value_attr (attr, sym->type (),
sym->print_name (),
&objfile->objfile_obstack, cu,
&value, &bytes, &baton);
if (noside != EVAL_AVOID_SIDE_EFFECTS)
throw;
- ret = value_zero (SYMBOL_TYPE (var), not_lval);
+ ret = value_zero (var->type (), not_lval);
}
return ret;
enum noside noside)
{
symbol *var = std::get<0> (m_storage).symbol;
- if (SYMBOL_TYPE (var)->code () == TYPE_CODE_ERROR)
+ if (var->type ()->code () == TYPE_CODE_ERROR)
error_unknown_type (var->print_name ());
return evaluate_var_value (noside, std::get<0> (m_storage).block, var);
}
NULL, std::get<0> (m_storage).symbol,
NULL, &symp, NULL, 0, noside);
- if (SYMBOL_TYPE (symp)->code () == TYPE_CODE_ERROR)
+ if (symp->type ()->code () == TYPE_CODE_ERROR)
error_unknown_type (symp->print_name ());
value *callee = evaluate_var_value (noside, std::get<0> (m_storage).block,
symp);
enum noside noside, symbol *sym)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (SYMBOL_TYPE (sym), not_lval);
+ return value_zero (sym->type (), not_lval);
if (SYMBOL_COMPUTED_OPS (sym) == NULL
|| SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry == NULL)
NON_METHOD,
nullptr, nullptr,
nullptr, &symp, nullptr, 0, noside);
- if (SYMBOL_TYPE (symp)->code () == TYPE_CODE_ERROR)
+ if (symp->type ()->code () == TYPE_CODE_ERROR)
error_unknown_type (symp->print_name ());
value *callee = evaluate_var_value (noside, std::get<1> (m_storage), symp);
return evaluate_subexp_do_call (exp, noside, callee, args,
/* C++: The "address" of a reference should yield the address
* of the object pointed to. Let value_addr() deal with it. */
- if (TYPE_IS_REFERENCE (SYMBOL_TYPE (var)))
+ if (TYPE_IS_REFERENCE (var->type ()))
return operation::evaluate_for_address (exp, noside);
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
- struct type *type = lookup_pointer_type (SYMBOL_TYPE (var));
+ struct type *type = lookup_pointer_type (var->type ());
enum address_class sym_class = var->aclass ();
if (sym_class == LOC_CONST
enum noside noside)
{
struct symbol *var = std::get<0> (m_storage).symbol;
- struct type *type = check_typedef (SYMBOL_TYPE (var));
+ struct type *type = check_typedef (var->type ());
if (type->code () == TYPE_CODE_ARRAY
&& !type->is_vector ()
&& CAST_IS_CONVERSION (exp->language_defn))
var_value_operation::evaluate_for_sizeof (struct expression *exp,
enum noside noside)
{
- struct type *type = SYMBOL_TYPE (std::get<0> (m_storage).symbol);
+ struct type *type = std::get<0> (m_storage).symbol->type ();
if (is_dynamic_type (type))
{
value *val = evaluate (nullptr, exp, EVAL_NORMAL);
domain, NULL);
if (result.symbol && result.symbol->aclass () == LOC_TYPEDEF)
{
- yylval.tsym.type = SYMBOL_TYPE (result.symbol);
+ yylval.tsym.type = result.symbol->type ();
return TYPENAME;
}
language_c, NULL).symbol;
if (obj_entry_sym == NULL)
error (_("Unable to find Struct_Obj_Entry symbol"));
- data->off_linkmap = lookup_struct_elt (SYMBOL_TYPE (obj_entry_sym),
+ data->off_linkmap = lookup_struct_elt (obj_entry_sym->type (),
"linkmap", 0).offset / 8;
- data->off_tlsindex = lookup_struct_elt (SYMBOL_TYPE (obj_entry_sym),
+ data->off_tlsindex = lookup_struct_elt (obj_entry_sym->type (),
"tlsindex", 0).offset / 8;
data->rtld_offsets_valid = true;
return;
struct frame_info *frame) const
{
struct value *v;
- struct type *type = SYMBOL_TYPE (var);
+ struct type *type = var->type ();
CORE_ADDR addr;
enum symbol_needs_kind sym_need;
sym = lookup_symbol_in_language (name, block, VAR_DOMAIN,
language->la_language, NULL).symbol;
if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
- return SYMBOL_TYPE (sym);
+ return sym->type ();
if (noerr)
return NULL;
{
error (_("No struct type named %s."), name);
}
- if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT)
+ if (sym->type ()->code () != TYPE_CODE_STRUCT)
{
error (_("This context has class, union or enum %s, not a struct."),
name);
}
- return (SYMBOL_TYPE (sym));
+ return (sym->type ());
}
/* Lookup a union type named "union NAME",
if (sym == NULL)
error (_("No union type named %s."), name);
- t = SYMBOL_TYPE (sym);
+ t = sym->type ();
if (t->code () == TYPE_CODE_UNION)
return t;
{
error (_("No enum type named %s."), name);
}
- if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_ENUM)
+ if (sym->type ()->code () != TYPE_CODE_ENUM)
{
error (_("This context has class, struct or union %s, not an enum."),
name);
}
- return (SYMBOL_TYPE (sym));
+ return (sym->type ());
}
/* Lookup a template type named "template NAME<TYPE>",
{
error (_("No template type named %s."), name);
}
- if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT)
+ if (sym->type ()->code () != TYPE_CODE_STRUCT)
{
error (_("This context has class, union or enum %s, not a struct."),
name);
}
- return (SYMBOL_TYPE (sym));
+ return (sym->type ());
}
/* See gdbtypes.h. */
}
sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0).symbol;
if (sym)
- TYPE_TARGET_TYPE (type) = SYMBOL_TYPE (sym);
+ TYPE_TARGET_TYPE (type) = sym->type ();
else /* TYPE_CODE_UNDEF */
TYPE_TARGET_TYPE (type) = alloc_type_arch (type->arch ());
}
/* Same as above for opaque types, we can replace the stub
with the complete type only if they are in the same
objfile. */
- if (SYMBOL_TYPE (sym)->objfile_owner () == type->objfile_owner ())
- type = make_qualified_type (SYMBOL_TYPE (sym),
+ if (sym->type ()->objfile_owner () == type->objfile_owner ())
+ type = make_qualified_type (sym->type (),
type->instance_flags (), type);
else
- type = SYMBOL_TYPE (sym);
+ type = sym->type ();
}
}
typeinfo_type
= (struct type *) gdbarch_data (gdbarch, std_type_info_gdbarch_data);
else
- typeinfo_type = SYMBOL_TYPE (typeinfo);
+ typeinfo_type = typeinfo->type ();
return typeinfo_type;
}
if (sym
&& sym->aclass () == LOC_TYPEDEF
- && SYMBOL_TYPE (sym)->code () == TYPE_CODE_MODULE)
+ && sym->type ()->code () == TYPE_CODE_MODULE)
return 1;
return 0;
= syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct symbol *symbol = s_smob->symbol;
- if (SYMBOL_TYPE (symbol) == NULL)
+ if (symbol->type () == NULL)
return SCM_BOOL_F;
- return tyscm_scm_from_type (SYMBOL_TYPE (symbol));
+ return tyscm_scm_from_type (symbol->type ());
}
/* (symbol-symtab <gdb:symbol>) -> <gdb:symtab> | #f
/* We're done. */
set_finished ();
- rv->type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
+ rv->type = TYPE_TARGET_TYPE (function->type ());
if (rv->type == NULL)
internal_error (__FILE__, __LINE__,
_("finish_command: function has no target type"));
printf_filtered (_("Run back to call of "));
else
{
- if (sm->function != NULL && TYPE_NO_RETURN (sm->function->type)
+ if (sm->function != NULL && TYPE_NO_RETURN (sm->function->type ())
&& !query (_("warning: Function %s does not return normally.\n"
"Try to finish anyway? "),
sm->function->print_name ()))
block_name->set_domain (VAR_DOMAIN);
block_name->set_aclass_index (LOC_BLOCK);
symbol_set_symtab (block_name, filetab);
- SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
+ block_name->set_type (lookup_function_type (block_type));
SYMBOL_BLOCK_VALUE (block_name) = new_block;
block_name->m_name = obstack_strdup (&objfile->objfile_obstack,
sym = lookup_symbol (m_bool_type_name, NULL, VAR_DOMAIN, NULL).symbol;
if (sym != nullptr)
{
- struct type *type = SYMBOL_TYPE (sym);
+ struct type *type = sym->type ();
if (type != nullptr && type->code () == TYPE_CODE_BOOL)
return type;
}
symbol->owner.arch = gdbarch;
symbol->set_is_objfile_owned (0);
symbol->set_section_index (0);
- SYMBOL_TYPE (symbol) = type;
+ symbol->set_type (type);
symbol->set_domain (VAR_DOMAIN);
symbol->set_aclass_index (LOC_TYPEDEF);
return symbol;
if (sym->aclass () != LOC_TYPEDEF)
return true; /* Continue iterating. */
- t = SYMBOL_TYPE (sym);
+ t = sym->type ();
t = check_typedef (t);
if (t->code () != TYPE_CODE_STRUCT
&& t->code () != TYPE_CODE_UNION
pspace = symbol_symtab (sym)->pspace ();
gdb_assert (!pspace->executing_startup);
set_current_program_space (pspace);
- t = check_typedef (SYMBOL_TYPE (sym));
+ t = check_typedef (sym->type ());
find_methods (t, sym->language (),
method_name, &result_names, &superclass_vec);
{
type = check_typedef (type);
fprintf_filtered (stream, "TYPE ");
- if (!SYMBOL_TYPE (new_symbol)->name ()
- || strcmp ((SYMBOL_TYPE (new_symbol))->name (),
+ if (!new_symbol->type ()->name ()
+ || strcmp ((new_symbol->type ())->name (),
new_symbol->linkage_name ()) != 0)
fprintf_filtered (stream, "%s = ", new_symbol->print_name ());
else
/* Type could be missing if file is compiled without debugging info. */
if (SC_IS_UNDEF (sh->sc)
|| sh->sc == scNil || sh->index == indexNil)
- SYMBOL_TYPE (s) = objfile_type (objfile)->nodebug_data_symbol;
+ s->set_type (objfile_type (objfile)->nodebug_data_symbol);
else
- SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
+ s->set_type (parse_type (cur_fd, ax, sh->index, 0, bigend, name));
/* Value of a data symbol is its memory address. */
}
break;
}
SYMBOL_VALUE (s) = svalue;
- SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
+ s->set_type (parse_type (cur_fd, ax, sh->index, 0, bigend, name));
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
s->set_domain (VAR_DOMAIN); /* So that it can be used */
s->set_aclass_index (LOC_LABEL); /* but not misused. */
SET_SYMBOL_VALUE_ADDRESS (s, (CORE_ADDR) sh->value);
- SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_int;
+ s->set_type (objfile_type (objfile)->builtin_int);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
add_symbol (s, top_stack->cur_st, b);
/* Make a type for the procedure itself. */
- SYMBOL_TYPE (s) = lookup_function_type (t);
+ s->set_type (lookup_function_type (t));
/* All functions in C++ have prototypes. For C we don't have enough
information in the debug info. */
if (s->language () == language_cplus)
- SYMBOL_TYPE (s)->set_is_prototyped (true);
+ s->type ()->set_is_prototyped (true);
/* Create and enter a new lexical context. */
b = new_block (FUNCTION_BLOCK, s->language ());
push_parse_stack ();
top_stack->cur_block = b;
top_stack->blocktype = sh->st;
- top_stack->cur_type = SYMBOL_TYPE (s);
+ top_stack->cur_type = s->type ();
top_stack->cur_field = -1;
top_stack->procadr = sh->value;
top_stack->numargs = 0;
(obstack_strdup (&mdebugread_objfile->objfile_obstack,
f->name ()));
enum_sym->set_aclass_index (LOC_CONST);
- SYMBOL_TYPE (enum_sym) = t;
+ enum_sym->set_type (t);
enum_sym->set_domain (VAR_DOMAIN);
SYMBOL_VALUE (enum_sym) = tsym.value;
if (SYMBOL_VALUE (enum_sym) < 0)
s->set_domain (STRUCT_DOMAIN);
s->set_aclass_index (LOC_TYPEDEF);
SYMBOL_VALUE (s) = 0;
- SYMBOL_TYPE (s) = t;
+ s->set_type (t);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
s->set_domain (LABEL_DOMAIN);
s->set_aclass_index (LOC_CONST);
- SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->builtin_void;
+ s->set_type (objfile_type (mdebugread_objfile)->builtin_void);
e = OBSTACK_ZALLOC (&mdebugread_objfile->objfile_obstack,
mdebug_extra_func_info);
SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e;
if (sym->is_argument ())
{
- ftype->field (iparams).set_type (SYMBOL_TYPE (sym));
+ ftype->field (iparams).set_type (sym->type ());
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
iparams++;
}
s->set_domain (VAR_DOMAIN);
s->set_aclass_index (LOC_TYPEDEF);
SYMBOL_BLOCK_VALUE (s) = top_stack->cur_block;
- SYMBOL_TYPE (s) = t;
+ s->set_type (t);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
/* Incomplete definitions of structs should not get a name. */
- if (SYMBOL_TYPE (s)->name () == NULL
- && (SYMBOL_TYPE (s)->num_fields () != 0
- || (SYMBOL_TYPE (s)->code () != TYPE_CODE_STRUCT
- && SYMBOL_TYPE (s)->code () != TYPE_CODE_UNION)))
+ if (s->type ()->name () == NULL
+ && (s->type ()->num_fields () != 0
+ || (s->type ()->code () != TYPE_CODE_STRUCT
+ && s->type ()->code () != TYPE_CODE_UNION)))
{
- if (SYMBOL_TYPE (s)->code () == TYPE_CODE_PTR
- || SYMBOL_TYPE (s)->code () == TYPE_CODE_FUNC)
+ if (s->type ()->code () == TYPE_CODE_PTR
+ || s->type ()->code () == TYPE_CODE_FUNC)
{
/* If we are giving a name to a type such as "pointer to
foo" or "function returning foo", we better not set
for anything except pointers or functions. */
}
else
- SYMBOL_TYPE (s)->set_name (s->linkage_name ());
+ s->type ()->set_name (s->linkage_name ());
}
break;
s->set_domain (VAR_DOMAIN);
SYMBOL_CLASS (s) = LOC_BLOCK;
/* Don't know its type, hope int is ok. */
- SYMBOL_TYPE (s)
+ s->type ()
= lookup_function_type (objfile_type (pst->objfile)->builtin_int);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
/* Won't have symbols for this one. */
if (processing_gcc_compilation == 0
&& found_ecoff_debugging_info == 0
- && TYPE_TARGET_TYPE (SYMBOL_TYPE (s))->code () == TYPE_CODE_VOID)
- SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->nodebug_text_symbol;
+ && TYPE_TARGET_TYPE (s->type ())->code () == TYPE_CODE_VOID)
+ s->set_type (objfile_type (mdebugread_objfile)->nodebug_text_symbol);
}
/* Parse the external symbol ES. Just call parse_symbol() after
s->set_domain (LABEL_DOMAIN);
s->set_aclass_index (LOC_CONST);
- SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_void;
+ s->set_type (objfile_type (objfile)->builtin_void);
SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e;
e->pdr.framereg = -1;
add_symbol_to_list (s, get_local_symbols ());
if (values == PRINT_SIMPLE_VALUES)
{
- check_typedef (arg->sym->type);
- type_print (arg->sym->type, "", &stb, -1);
+ check_typedef (arg->sym->type ());
+ type_print (arg->sym->type (), "", &stb, -1);
uiout->field_stream ("type", stb);
}
switch (values)
{
case PRINT_SIMPLE_VALUES:
- type = check_typedef (sym2->type);
+ type = check_typedef (sym2->type ());
if (type->code () != TYPE_CODE_ARRAY
&& type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_UNION)
if (kind == FUNCTIONS_DOMAIN || kind == VARIABLES_DOMAIN)
{
string_file tmp_stream;
- type_print (SYMBOL_TYPE (sym), "", &tmp_stream, -1);
+ type_print (sym->type (), "", &tmp_stream, -1);
uiout->field_string ("type", tmp_stream.string ());
std::string str = symbol_to_info_string (sym, block, kind);
else
error (_("No struct type named %s."), name);
}
- if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT)
+ if (sym->type ()->code () != TYPE_CODE_STRUCT)
{
if (noerr)
return 0;
if (sym == NULL)
type = builtin_type (gdbarch)->builtin_data_ptr;
else
- type = lookup_pointer_type(SYMBOL_TYPE (sym));
+ type = lookup_pointer_type(sym->type ());
deprecated_set_value_type (nsstringValue, type);
return nsstringValue;
pstate->block_tracker->update (sym);
pstate->push_new<var_value_operation> (sym);
- current_type = sym.symbol->type; }
+ current_type = sym.symbol->type (); }
else if ($1.is_a_field_of_this)
{
struct value * this_val;
break;
}
- yylval.tsym.type = SYMBOL_TYPE (best_sym);
+ yylval.tsym.type = best_sym->type ();
#else /* not 0 */
- yylval.tsym.type = SYMBOL_TYPE (sym);
+ yylval.tsym.type = sym->type ();
#endif /* not 0 */
free (uptokstart);
return TYPENAME;
if (wsym)
{
- wtype = SYMBOL_TYPE (wsym);
+ wtype = wsym->type ();
}
else
{
if (function != NULL)
{
struct type *ret_type =
- check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (function)));
+ check_typedef (TYPE_TARGET_TYPE (function->type ()));
/* Remember only non-void return types. */
if (ret_type->code () != TYPE_CODE_VOID)
SYMPY_REQUIRE_VALID (self, symbol);
- if (SYMBOL_TYPE (symbol) == NULL)
+ if (symbol->type () == NULL)
{
Py_INCREF (Py_None);
return Py_None;
}
- return type_to_type_object (SYMBOL_TYPE (symbol));
+ return type_to_type_object (symbol->type ());
}
static PyObject *
sym = TYPE_TEMPLATE_ARGUMENT (type, argno);
if (sym->aclass () == LOC_TYPEDEF)
- return type_to_type_object (SYMBOL_TYPE (sym));
+ return type_to_type_object (sym->type ());
else if (sym->aclass () == LOC_OPTIMIZED_OUT)
{
PyErr_Format (PyExc_RuntimeError,
if (sym.symbol == NULL)
error (_("Could not find function named '%s'"), name.c_str ());
- struct type *fn_type = SYMBOL_TYPE (sym.symbol);
+ struct type *fn_type = sym.symbol->type ();
if (fn_type->num_fields () == 0)
error (_("Function '%s' takes no arguments"), name.c_str ());
if (result.symbol != NULL)
{
update_innermost_block (result);
- return SYMBOL_TYPE (result.symbol);
+ return result.symbol->type ();
}
type = lookup_typename (language (), name, NULL, 1);
if (sym.symbol != nullptr)
{
gdb_assert (sym.symbol->aclass () == LOC_TYPEDEF);
- type = SYMBOL_TYPE (sym.symbol);
+ type = sym.symbol->type ();
}
if (type == nullptr)
type = rust_lookup_type (name.c_str ());
static int
sparc32_struct_return_from_sym (struct symbol *sym)
{
- struct type *type = check_typedef (SYMBOL_TYPE (sym));
+ struct type *type = check_typedef (sym->type ());
enum type_code code = type->code ();
if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
/* I don't think the linker does this with functions,
so as far as I know this is never executed.
But it doesn't hurt to check. */
- SYMBOL_TYPE (sym) =
- lookup_function_type (read_type (&pp, objfile));
+ sym->set_type
+ (lookup_function_type (read_type (&pp, objfile)));
}
else
{
- SYMBOL_TYPE (sym) = read_type (&pp, objfile);
+ sym->set_type (read_type (&pp, objfile));
}
add_symbol_to_list (sym, get_global_symbols ());
}
pp += 2;
if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
{
- SYMBOL_TYPE (sym) =
- lookup_function_type (read_type (&pp, objfile));
+ sym->set_type
+ (lookup_function_type (read_type (&pp, objfile)));
}
else
{
- SYMBOL_TYPE (sym) = read_type (&pp, objfile);
+ sym->set_type (read_type (&pp, objfile));
}
}
}
if (*p != '=')
{
sym->set_aclass_index (LOC_CONST);
- SYMBOL_TYPE (sym) = error_type (&p, objfile);
+ sym->set_type (error_type (&p, objfile));
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
return sym;
target_float_from_string (dbl_valu, dbl_type, std::string (p));
- SYMBOL_TYPE (sym) = dbl_type;
+ sym->set_type (dbl_type);
SYMBOL_VALUE_BYTES (sym) = dbl_valu;
sym->set_aclass_index (LOC_CONST_BYTES);
}
types; other languages probably should have at least
unsigned as well as signed constants. */
- SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_long;
+ sym->set_type (objfile_type (objfile)->builtin_long);
SYMBOL_VALUE (sym) = atoi (p);
sym->set_aclass_index (LOC_CONST);
}
case 'c':
{
- SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_char;
+ sym->set_type (objfile_type (objfile)->builtin_char);
SYMBOL_VALUE (sym) = atoi (p);
sym->set_aclass_index (LOC_CONST);
}
if (quote != '\'' && quote != '"')
{
sym->set_aclass_index (LOC_CONST);
- SYMBOL_TYPE (sym) = error_type (&p, objfile);
+ sym->set_type (error_type (&p, objfile));
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
return sym;
if (*p != quote)
{
sym->set_aclass_index (LOC_CONST);
- SYMBOL_TYPE (sym) = error_type (&p, objfile);
+ sym->set_type (error_type (&p, objfile));
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
return sym;
= create_static_range_type (NULL,
objfile_type (objfile)->builtin_int,
0, ind);
- SYMBOL_TYPE (sym) = create_array_type (NULL,
- objfile_type (objfile)->builtin_char,
- range_type);
+ sym->set_type
+ (create_array_type (NULL, objfile_type (objfile)->builtin_char,
+ range_type));
string_value
= (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, ind + 1);
memcpy (string_value, string_local, ind + 1);
(where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
{
sym->set_aclass_index (LOC_CONST);
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
if (*p != ',')
{
- SYMBOL_TYPE (sym) = error_type (&p, objfile);
+ sym->set_type (error_type (&p, objfile));
break;
}
++p;
default:
{
sym->set_aclass_index (LOC_CONST);
- SYMBOL_TYPE (sym) = error_type (&p, objfile);
+ sym->set_type (error_type (&p, objfile));
}
}
sym->set_domain (VAR_DOMAIN);
case 'C':
/* The name of a caught exception. */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_LABEL);
sym->set_domain (VAR_DOMAIN);
SET_SYMBOL_VALUE_ADDRESS (sym, valu);
case 'f':
/* A static function definition. */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_BLOCK);
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
/* Function result types are described as the result type in stabs.
We need to convert this to the function-returning-type-X type
in GDB. E.g. "int" is converted to "function returning int". */
- if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_FUNC)
- SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym));
+ if (sym->type ()->code () != TYPE_CODE_FUNC)
+ sym->set_type (lookup_function_type (sym->type ()));
/* All functions in C++ have prototypes. Stabs does not offer an
explicit way to identify prototyped or unprototyped functions,
than the "declared-as" type for unprototyped functions, so
we treat all functions as if they were prototyped. This is used
primarily for promotion when calling the function from GDB. */
- SYMBOL_TYPE (sym)->set_is_prototyped (true);
+ sym->type ()->set_is_prototyped (true);
/* fall into process_prototype_types. */
/* Sun acc puts declared types of arguments here. */
if (*p == ';')
{
- struct type *ftype = SYMBOL_TYPE (sym);
+ struct type *ftype = sym->type ();
int nsemi = 0;
int nparams = 0;
const char *p1 = p;
case 'F':
/* A global function definition. */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_BLOCK);
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_global_symbols ());
value is not correct. It is necessary to search for the
corresponding linker definition to find the value.
These definitions appear at the end of the namelist. */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_STATIC);
sym->set_domain (VAR_DOMAIN);
/* Don't add symbol references to global_sym_chain.
Dbx data never actually contains 'l'. */
case 's':
case 'l':
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_LOCAL);
SYMBOL_VALUE (sym) = valu;
sym->set_domain (VAR_DOMAIN);
Translate it into a pointer-to-function type. */
{
p++;
- SYMBOL_TYPE (sym)
- = lookup_pointer_type
- (lookup_function_type (read_type (&p, objfile)));
+ sym->set_type
+ (lookup_pointer_type
+ (lookup_function_type (read_type (&p, objfile))));
}
else
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_ARG);
SYMBOL_VALUE (sym) = valu;
{
/* If PCC says a parameter is a short or a char, it is
really an int. */
- if (TYPE_LENGTH (SYMBOL_TYPE (sym))
+ if (TYPE_LENGTH (sym->type ())
< gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT
- && SYMBOL_TYPE (sym)->code () == TYPE_CODE_INT)
+ && sym->type ()->code () == TYPE_CODE_INT)
{
- SYMBOL_TYPE (sym) =
- (SYMBOL_TYPE (sym)->is_unsigned ()
+ sym->set_type
+ (sym->type ()->is_unsigned ()
? objfile_type (objfile)->builtin_unsigned_int
: objfile_type (objfile)->builtin_int);
}
with this extra information. FIXME, it ought to. */
if (type == N_FUN)
{
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
goto process_prototype_types;
}
/*FALLTHROUGH */
case 'R':
/* Parameter which is in a register. */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (stab_register_index);
sym->set_is_argument (1);
SYMBOL_VALUE (sym) = valu;
case 'r':
/* Register variable (either global or local). */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (stab_register_index);
SYMBOL_VALUE (sym) = valu;
sym->set_domain (VAR_DOMAIN);
struct pending *local_symbols = *get_local_symbols ();
if (local_symbols
&& local_symbols->nsyms > 0
- && gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym)))
+ && gdbarch_stabs_argument_has_addr (gdbarch, sym->type ()))
{
struct symbol *prev_sym;
prev_sym->set_aclass_index (stab_register_index);
/* Use the type from the LOC_REGISTER; that is the type
that is actually in that register. */
- SYMBOL_TYPE (prev_sym) = SYMBOL_TYPE (sym);
+ prev_sym->set_type (sym->type ());
SYMBOL_VALUE (prev_sym) = SYMBOL_VALUE (sym);
sym = prev_sym;
break;
case 'S':
/* Static symbol at top level of file. */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_STATIC);
SET_SYMBOL_VALUE_ADDRESS (sym, valu);
sym->set_domain (VAR_DOMAIN);
synonym = (sym->language () == language_ada && p[-2] != 'T');
/* Typedef */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
/* For a nameless type, we don't want a create a symbol, thus we
did not use `sym'. Return without further processing. */
a base type which did not have its name defined when the
derived class was output. We fill in the derived class's
base part member's name here in that case. */
- if (SYMBOL_TYPE (sym)->name () != NULL)
- if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT
- || SYMBOL_TYPE (sym)->code () == TYPE_CODE_UNION)
- && TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)))
+ if (sym->type ()->name () != NULL)
+ if ((sym->type ()->code () == TYPE_CODE_STRUCT
+ || sym->type ()->code () == TYPE_CODE_UNION)
+ && TYPE_N_BASECLASSES (sym->type ()))
{
int j;
- for (j = TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)) - 1; j >= 0; j--)
- if (TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) == 0)
- SYMBOL_TYPE (sym)->field (j).set_name
- (TYPE_BASECLASS (SYMBOL_TYPE (sym), j)->name ());
+ for (j = TYPE_N_BASECLASSES (sym->type ()) - 1; j >= 0; j--)
+ if (TYPE_BASECLASS_NAME (sym->type (), j) == 0)
+ sym->type ()->field (j).set_name
+ (TYPE_BASECLASS (sym->type (), j)->name ());
}
- if (SYMBOL_TYPE (sym)->name () == NULL)
+ if (sym->type ()->name () == NULL)
{
- if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
+ if ((sym->type ()->code () == TYPE_CODE_PTR
&& strcmp (sym->linkage_name (), vtbl_ptr_name))
- || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC)
+ || sym->type ()->code () == TYPE_CODE_FUNC)
{
/* If we are giving a name to a type such as "pointer to
foo" or "function returning foo", we better not set
/* Pascal accepts names for pointer types. */
if (get_current_subfile ()->language == language_pascal)
- SYMBOL_TYPE (sym)->set_name (sym->linkage_name ());
+ sym->type ()->set_name (sym->linkage_name ());
}
else
- SYMBOL_TYPE (sym)->set_name (sym->linkage_name ());
+ sym->type ()->set_name (sym->linkage_name ());
}
add_symbol_to_list (sym, get_file_symbols ());
struct_sym->set_aclass_index (LOC_TYPEDEF);
SYMBOL_VALUE (struct_sym) = valu;
struct_sym->set_domain (STRUCT_DOMAIN);
- if (SYMBOL_TYPE (sym)->name () == 0)
- SYMBOL_TYPE (sym)->set_name
+ if (sym->type ()->name () == 0)
+ sym->type ()->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL));
add_symbol_to_list (struct_sym, get_file_symbols ());
if (synonym)
p++;
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
/* For a nameless type, we don't want a create a symbol, thus we
did not use `sym'. Return without further processing. */
sym->set_aclass_index (LOC_TYPEDEF);
SYMBOL_VALUE (sym) = valu;
sym->set_domain (STRUCT_DOMAIN);
- if (SYMBOL_TYPE (sym)->name () == 0)
- SYMBOL_TYPE (sym)->set_name
+ if (sym->type ()->name () == 0)
+ sym->type ()->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL));
add_symbol_to_list (sym, get_file_symbols ());
typedef_sym->set_aclass_index (LOC_TYPEDEF);
SYMBOL_VALUE (typedef_sym) = valu;
typedef_sym->set_domain (VAR_DOMAIN);
- if (SYMBOL_TYPE (sym)->name () == 0)
- SYMBOL_TYPE (sym)->set_name
+ if (sym->type ()->name () == 0)
+ sym->type ()->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL));
add_symbol_to_list (typedef_sym, get_file_symbols ());
case 'V':
/* Static symbol of local scope. */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_STATIC);
SET_SYMBOL_VALUE_ADDRESS (sym, valu);
sym->set_domain (VAR_DOMAIN);
case 'v':
/* Reference parameter */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_REF_ARG);
sym->set_is_argument (1);
SYMBOL_VALUE (sym) = valu;
case 'a':
/* Reference parameter which is in a register. */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (stab_regparm_index);
sym->set_is_argument (1);
SYMBOL_VALUE (sym) = valu;
Sun claims ("dbx and dbxtool interfaces", 2nd ed)
that Pascal uses it too, but when I tried it Pascal used
"x:3" (local symbol) instead. */
- SYMBOL_TYPE (sym) = read_type (&p, objfile);
+ sym->set_type (read_type (&p, objfile));
sym->set_aclass_index (LOC_LOCAL);
SYMBOL_VALUE (sym) = valu;
sym->set_domain (VAR_DOMAIN);
break;
default:
- SYMBOL_TYPE (sym) = error_type (&p, objfile);
+ sym->set_type (error_type (&p, objfile));
sym->set_aclass_index (LOC_CONST);
SYMBOL_VALUE (sym) = 0;
sym->set_domain (VAR_DOMAIN);
of by value, i.e. they will pass the address of a structure (in a
register or on the stack) instead of the structure itself. */
- if (gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym))
+ if (gdbarch_stabs_argument_has_addr (gdbarch, sym->type ())
&& sym->is_argument ())
{
/* We have to convert LOC_REGISTER to LOC_REGPARM_ADDR (for
if (sym->aclass () == LOC_TYPEDEF
&& sym->domain () == STRUCT_DOMAIN
- && (SYMBOL_TYPE (sym)->code () == code)
+ && (sym->type ()->code () == code)
&& strcmp (sym->linkage_name (), type_name) == 0)
{
obstack_free (&objfile->objfile_obstack, type_name);
- type = SYMBOL_TYPE (sym);
+ type = sym->type ();
if (typenums[0] != -1)
*dbx_lookup_type (typenums, objfile) = type;
return type;
{
struct symbol *xsym = syms->symbol[j];
- SYMBOL_TYPE (xsym) = type;
+ xsym->set_type (type);
type->field (n).set_name (xsym->linkage_name ());
type->field (n).set_loc_enumval (SYMBOL_VALUE (xsym));
TYPE_FIELD_BITSIZE (type, n) = 0;
for (j = common_block_i; j < common_block->nsyms; j++)
add_symbol_to_list (common_block->symbol[j], &newobj);
- SYMBOL_TYPE (sym) = (struct type *) newobj;
+ sym->set_type ((struct type *) newobj);
/* Should we be putting local_symbols back to what it was?
Does it matter? */
static void
fix_common_block (struct symbol *sym, CORE_ADDR valu)
{
- struct pending *next = (struct pending *) SYMBOL_TYPE (sym);
+ struct pending *next = (struct pending *) sym->type ();
for (; next; next = next->next)
{
if (sym->aclass () == LOC_TYPEDEF
&& sym->domain () == STRUCT_DOMAIN
- && (SYMBOL_TYPE (sym)->code () == (*type)->code ())
+ && (sym->type ()->code () == (*type)->code ())
&& ((*type)->instance_flags ()
- == SYMBOL_TYPE (sym)->instance_flags ())
+ == sym->type ()->instance_flags ())
&& strcmp (sym->linkage_name (), type_name) == 0)
- replace_type (*type, SYMBOL_TYPE (sym));
+ replace_type (*type, sym->type ());
}
}
}
|| (fp_opts.print_entry_values == print_entry_values_preferred
&& (!val || value_optimized_out (val))))
{
- entryval = allocate_optimized_out_value (SYMBOL_TYPE (sym));
+ entryval = allocate_optimized_out_value (sym->type ());
entryval_error = NULL;
}
}
case LOC_REF_ARG:
{
long current_offset = SYMBOL_VALUE (sym);
- int arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym));
+ int arg_size = TYPE_LENGTH (sym->type ());
/* Compute address of next argument by adding the size of
this argument and rounding to an int boundary. */
/* Cast return value to the return type of the function. Should
the cast fail, this call throws an error. */
if (thisfun != NULL)
- return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun));
+ return_type = TYPE_TARGET_TYPE (thisfun->type ());
if (return_type == NULL)
{
if (retval_expr->first_opcode () != UNOP_CAST
query_prefix);
else
{
- if (TYPE_NO_RETURN (thisfun->type))
+ if (TYPE_NO_RETURN (thisfun->type ()))
warning (_("Function does not return normally to caller."));
confirmed = query (_("%sMake %s return now? "), query_prefix,
thisfun->print_name ());
if (symbol->domain () == STRUCT_DOMAIN)
{
- if (SYMBOL_TYPE (symbol)->name ())
+ if (symbol->type ()->name ())
{
- LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
+ LA_PRINT_TYPE (symbol->type (), "", outfile, 1, depth,
&type_print_raw_options);
}
else
{
fprintf_filtered (outfile, "%s %s = ",
- (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_ENUM
+ (symbol->type ()->code () == TYPE_CODE_ENUM
? "enum"
- : (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_STRUCT
+ : (symbol->type ()->code () == TYPE_CODE_STRUCT
? "struct" : "union")),
symbol->linkage_name ());
- LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
+ LA_PRINT_TYPE (symbol->type (), "", outfile, 1, depth,
&type_print_raw_options);
}
fprintf_filtered (outfile, ";\n");
{
if (symbol->aclass () == LOC_TYPEDEF)
fprintf_filtered (outfile, "typedef ");
- if (SYMBOL_TYPE (symbol))
+ if (symbol->type ())
{
/* Print details of types, except for enums where it's clutter. */
- LA_PRINT_TYPE (SYMBOL_TYPE (symbol), symbol->print_name (),
+ LA_PRINT_TYPE (symbol->type (), symbol->print_name (),
outfile,
- SYMBOL_TYPE (symbol)->code () != TYPE_CODE_ENUM,
+ symbol->type ()->code () != TYPE_CODE_ENUM,
depth,
&type_print_raw_options);
fprintf_filtered (outfile, "; ");
case LOC_CONST_BYTES:
{
unsigned i;
- struct type *type = check_typedef (SYMBOL_TYPE (symbol));
+ struct type *type = check_typedef (symbol->type ());
fprintf_filtered (outfile, "const %s hex bytes:",
pulongest (TYPE_LENGTH (type)));
if (result.symbol)
{
- struct type *t = result.symbol->type;
+ struct type *t = result.symbol->type ();
/* I'm not really sure that type of this can ever
be typedefed; just be safe. */
block_find_non_opaque_type, NULL);
if (sym == NULL)
error_in_psymtab_expansion (block_index, name, cust);
- gdb_assert (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)));
- return SYMBOL_TYPE (sym);
+ gdb_assert (!TYPE_IS_OPAQUE (sym->type ()));
+ return sym->type ();
}
/* Subroutine of basic_lookup_transparent_type to simplify it.
block_find_non_opaque_type, NULL);
if (sym != NULL)
{
- gdb_assert (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)));
- return SYMBOL_TYPE (sym);
+ gdb_assert (!TYPE_IS_OPAQUE (sym->type ()));
+ return sym->type ();
}
}
sym->natural_name ());
}
- sym_type = SYMBOL_TYPE (sym);
+ sym_type = sym->type ();
if (sym_type == NULL)
return false;
members. We only want to skip enums
here. */
&& !(sym->aclass () == LOC_CONST
- && (SYMBOL_TYPE (sym)->code ()
+ && (sym->type ()->code ()
== TYPE_CODE_ENUM))
&& (!treg.has_value ()
|| treg_matches_sym_type_name (*treg, sym)))
For the struct printing case below, things are worse, we force
printing of the ";" in this function, which is going to be wrong
for languages that don't require a ";" between statements. */
- if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_TYPEDEF)
- typedef_print (SYMBOL_TYPE (sym), sym, &tmp_stream);
+ if (sym->type ()->code () == TYPE_CODE_TYPEDEF)
+ typedef_print (sym->type (), sym, &tmp_stream);
else
- type_print (SYMBOL_TYPE (sym), "", &tmp_stream, -1);
+ type_print (sym->type (), "", &tmp_stream, -1);
str += tmp_stream.string ();
}
/* variable, func, or typedef-that-is-c++-class. */
{
string_file tmp_stream;
- type_print (SYMBOL_TYPE (sym),
+ type_print (sym->type (),
(sym->aclass () == LOC_TYPEDEF
? "" : sym->print_name ()),
&tmp_stream, 0);
{
if (sym->aclass () == LOC_TYPEDEF)
{
- struct type *t = SYMBOL_TYPE (sym);
+ struct type *t = sym->type ();
enum type_code c = t->code ();
int j;
bool
symbol_is_function_or_method (symbol *sym)
{
- switch (SYMBOL_TYPE (sym)->code ())
+ switch (sym->type ()->code ())
{
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
if (code == TYPE_CODE_UNDEF
|| (sym->domain () == STRUCT_DOMAIN
- && SYMBOL_TYPE (sym)->code () == code))
+ && sym->type ()->code () == code))
completion_list_add_symbol (tracker, sym,
lookup_name,
text, word);
sym_text, word);
}
else if (sym->domain () == STRUCT_DOMAIN
- && SYMBOL_TYPE (sym)->code () == code)
+ && sym->type ()->code () == code)
completion_list_add_symbol (tracker, sym, lookup_name,
sym_text, word);
}
return this->subclass == SYMBOL_TEMPLATE;
}
+ struct type *type () const
+ {
+ return m_type;
+ }
+
+ void set_type (struct type *type)
+ {
+ m_type = type;
+ }
+
/* Data type of value */
- struct type *type = nullptr;
+ struct type *m_type = nullptr;
/* The owner of this symbol.
Which one to use is defined by symbol.is_objfile_owned. */
/* Note: There is no accessor macro for symbol.owner because it is
"private". */
-#define SYMBOL_TYPE(symbol) (symbol)->type
#define SYMBOL_LINE(symbol) (symbol)->line
#define SYMBOL_COMPUTED_OPS(symbol) ((symbol)->impl ().ops_computed)
#define SYMBOL_BLOCK_OPS(symbol) ((symbol)->impl ().ops_block)
bfd_signed_vma offset;
int treat_as_expr = 0;
- len = TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym)));
+ len = TYPE_LENGTH (check_typedef (sym->type ()));
switch (sym->aclass ())
{
default:
}
/* A struct may be a C++ class with static fields, go to general
expression handling. */
- if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT)
+ if (sym->type ()->code () == TYPE_CODE_STRUCT)
treat_as_expr = 1;
else
add_memrange (gdbarch, memrange_absolute, offset, len, scope);
add_local_register (gdbarch, reg, scope);
/* Check for doubles stored in two registers. */
/* FIXME: how about larger types stored in 3 or more regs? */
- if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_FLT &&
+ if (sym->type ()->code () == TYPE_CODE_FLT &&
len > register_size (gdbarch, reg))
add_local_register (gdbarch, reg + 1, scope);
break;
break;
case LOC_CONST_BYTES:
printf_filtered ("constant bytes: ");
- if (SYMBOL_TYPE (sym))
- for (j = 0; j < TYPE_LENGTH (SYMBOL_TYPE (sym)); j++)
+ if (sym->type ())
+ for (j = 0; j < TYPE_LENGTH (sym->type ()); j++)
printf_filtered (" %02x",
(unsigned) SYMBOL_VALUE_BYTES (sym)[j]);
break;
gdb_assert_not_reached ("LOC_COMPUTED variable missing a method");
}
}
- if (SYMBOL_TYPE (sym))
+ if (sym->type ())
{
- struct type *t = check_typedef (SYMBOL_TYPE (sym));
+ struct type *t = check_typedef (sym->type ());
printf_filtered (", length %s.\n", pulongest (TYPE_LENGTH (t)));
}
tf = XOBNEW (&m_storage, struct decl_field);
tf->name = TYPE_TEMPLATE_ARGUMENT (t, i)->linkage_name ();
- tf->type = SYMBOL_TYPE (TYPE_TEMPLATE_ARGUMENT (t, i));
+ tf->type = TYPE_TEMPLATE_ARGUMENT (t, i)->type ();
slot = htab_find_slot (m_table.get (), tf, INSERT);
if (*slot == NULL)
struct value *
address_of_variable (struct symbol *var, const struct block *b)
{
- struct type *type = SYMBOL_TYPE (var);
+ struct type *type = var->type ();
struct value *val;
/* Evaluate it first; if the result is a memory address, we're fine.
the function part. Do not try this for non-functions (e.g.
function pointers). */
if (qualified_name
- && (check_typedef (SYMBOL_TYPE (fsym))->code ()
+ && (check_typedef (fsym->type ())->code ()
== TYPE_CODE_FUNC))
{
temp_func = cp_func_name (qualified_name);
static_offset = oload_method_static_p (methods, ix);
}
else
- nparms = SYMBOL_TYPE (functions[ix])->num_fields ();
+ nparms = functions[ix]->type ()->num_fields ();
parm_types.reserve (nparms);
for (jj = 0; jj < nparms; jj++)
{
type *t = (methods != NULL
? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ())
- : SYMBOL_TYPE (functions[ix])->field (jj).type ());
+ : functions[ix]->type ()->field (jj).type ());
parm_types.push_back (t);
}
}
return NULL;
else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
&& (sym.symbol->aclass () == LOC_TYPEDEF))
- result = allocate_value (SYMBOL_TYPE (sym.symbol));
+ result = allocate_value (sym.symbol->type ());
else
result = value_of_variable (sym.symbol, sym.block);
patch_block_stabs (), unless the file was compiled without -g. */
sym->set_linkage_name (SYMNAME_ALLOC (name, symname_alloced));
- SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol;
+ sym->set_type (objfile_type (objfile)->nodebug_text_symbol);
sym->set_aclass_index (LOC_BLOCK);
sym2 = new (&objfile->objfile_obstack) symbol (*sym);
else
{
/* In case we can't figure out the type, provide default. */
- SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_data_symbol;
+ sym->set_type (objfile_type (objfile)->nodebug_data_symbol);
switch (cs->c_sclass)
{