/* First try the file name given in the section. If that doesn't
work, try to use the build-id instead. */
- gdb_bfd_ref_ptr dwz_bfd (gdb_bfd_open (filename, gnutarget, -1));
+ gdb_bfd_ref_ptr dwz_bfd (gdb_bfd_open (filename, gnutarget));
if (dwz_bfd != NULL)
{
if (!build_id_verify (dwz_bfd.get (), buildid_len, buildid))
if (fd.get () >= 0)
{
/* File successfully retrieved from server. */
- dwz_bfd = gdb_bfd_open (alt_filename.get (), gnutarget, -1);
+ dwz_bfd = gdb_bfd_open (alt_filename.get (), gnutarget);
if (dwz_bfd == nullptr)
warning (_("File \"%s\" from debuginfod cannot be opened as bfd"),
}
}
+static void
+dw2_expand_symtabs_matching_symbol
+ (mapped_index_base &index,
+ const lookup_name_info &lookup_name_in,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ enum search_domain kind,
+ gdb::function_view<bool (offset_type)> match_callback);
+
+static void
+dw2_expand_symtabs_matching_one
+ (struct dwarf2_per_cu_data *per_cu,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify);
+
static void
dw2_map_matching_symbols
(struct objfile *objfile,
struct dwarf2_per_objfile *dwarf2_per_objfile
= get_dwarf2_per_objfile (objfile);
+ const block_enum block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
+
if (dwarf2_per_objfile->index_table != nullptr)
{
/* Ada currently doesn't support .gdb_index (see PR24713). We can get
here though if the current language is Ada for a non-Ada objfile
- using GNU index. As Ada does not look for non-Ada symbols this
- function should just return. */
- return;
- }
+ using GNU index. */
+ mapped_index &index = *dwarf2_per_objfile->index_table;
+
+ const char *match_name = name.ada ().lookup_name ().c_str ();
+ auto matcher = [&] (const char *symname)
+ {
+ if (ordered_compare == nullptr)
+ return true;
+ return ordered_compare (symname, match_name) == 0;
+ };
+
+ dw2_expand_symtabs_matching_symbol (index, name, matcher, ALL_DOMAIN,
+ [&] (offset_type namei)
+ {
+ struct dw2_symtab_iterator iter;
+ struct dwarf2_per_cu_data *per_cu;
- /* We have -readnow: no .gdb_index, but no partial symtabs either. So,
- inline psym_map_matching_symbols here, assuming all partial symtabs have
- been read in. */
- const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
+ dw2_symtab_iter_init (&iter, dwarf2_per_objfile, block_kind, domain,
+ match_name);
+ while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
+ dw2_expand_symtabs_matching_one (per_cu, nullptr, nullptr);
+ return true;
+ });
+ }
+ else
+ {
+ /* We have -readnow: no .gdb_index, but no partial symtabs either. So,
+ proceed assuming all symtabs have been read in. */
+ }
for (compunit_symtab *cust : objfile->compunits ())
{
saved_package_name);
struct symbol *sym;
- sym = allocate_symbol (objfile);
+ sym = new (&objfile->objfile_obstack) symbol;
sym->set_language (language_go, &objfile->objfile_obstack);
sym->compute_and_set_names (saved_package_name, false, objfile->per_bfd);
/* This is not VAR_DOMAIN because we want a way to ensure a lookup of,
/* When DISCRIMINANT_INDEX == -1, we have a univariant enum. Those
must be handled by the caller. */
gdb_assert (discriminant_index >= 0
- && discriminant_index < TYPE_NFIELDS (type));
+ && discriminant_index < type->num_fields ());
gdb_assert (default_index == -1
- || (default_index >= 0 && default_index < TYPE_NFIELDS (type)));
+ || (default_index >= 0 && default_index < type->num_fields ()));
/* We have one variant for each non-discriminant field. */
- int n_variants = TYPE_NFIELDS (type) - 1;
+ int n_variants = type->num_fields () - 1;
variant *variants = new (obstack) variant[n_variants];
int var_idx = 0;
int range_idx = 0;
- for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+ for (int i = 0; i < type->num_fields (); ++i)
{
if (i == discriminant_index)
continue;
static void
quirk_rust_enum (struct type *type, struct objfile *objfile)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_UNION);
/* We don't need to deal with empty enums. */
- if (TYPE_NFIELDS (type) == 0)
+ if (type->num_fields () == 0)
return;
#define RUST_ENUM_PREFIX "RUST$ENCODED$ENUM$"
- if (TYPE_NFIELDS (type) == 1
+ if (type->num_fields () == 1
&& startswith (TYPE_FIELD_NAME (type, 0), RUST_ENUM_PREFIX))
{
const char *name = TYPE_FIELD_NAME (type, 0) + strlen (RUST_ENUM_PREFIX);
unsigned long index = strtoul (name, &tail, 10);
name = tail;
if (*name != '$'
- || index >= TYPE_NFIELDS (field_type)
+ || index >= field_type->num_fields ()
|| (TYPE_FIELD_LOC_KIND (field_type, index)
!= FIELD_LOC_KIND_BITPOS))
{
/* Smash this type to be a structure type. We have to do this
because the type has already been recorded. */
type->set_code (TYPE_CODE_STRUCT);
- TYPE_NFIELDS (type) = 3;
+ type->set_num_fields (3);
/* Save the field we care about. */
- struct field saved_field = TYPE_FIELD (type, 0);
- TYPE_FIELDS (type)
- = (struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field));
+ struct field saved_field = type->field (0);
+ type->set_fields
+ ((struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field)));
/* Put the discriminant at index 0. */
TYPE_FIELD_TYPE (type, 0) = field_type;
TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
- SET_FIELD_BITPOS (TYPE_FIELD (type, 0), bit_offset);
+ SET_FIELD_BITPOS (type->field (0), bit_offset);
/* The order of fields doesn't really matter, so put the real
field at index 1 and the data-less field at index 2. */
- TYPE_FIELD (type, 1) = saved_field;
+ type->field (1) = saved_field;
TYPE_FIELD_NAME (type, 1)
- = rust_last_path_segment (TYPE_NAME (TYPE_FIELD_TYPE (type, 1)));
- TYPE_NAME (TYPE_FIELD_TYPE (type, 1))
- = rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type),
- TYPE_FIELD_NAME (type, 1));
+ = rust_last_path_segment (TYPE_FIELD_TYPE (type, 1)->name ());
+ TYPE_FIELD_TYPE (type, 1)->set_name
+ (rust_fully_qualify (&objfile->objfile_obstack, type->name (),
+ TYPE_FIELD_NAME (type, 1)));
const char *dataless_name
- = rust_fully_qualify (&objfile->objfile_obstack, TYPE_NAME (type),
+ = rust_fully_qualify (&objfile->objfile_obstack, type->name (),
name);
struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
dataless_name);
/* NAME points into the original discriminant name, which
already has the correct lifetime. */
TYPE_FIELD_NAME (type, 2) = name;
- SET_FIELD_BITPOS (TYPE_FIELD (type, 2), 0);
+ SET_FIELD_BITPOS (type->field (2), 0);
/* Indicate that this is a variant type. */
static discriminant_range ranges[1] = { { 0, 0 } };
}
/* A union with a single anonymous field is probably an old-style
univariant enum. */
- else if (TYPE_NFIELDS (type) == 1 && streq (TYPE_FIELD_NAME (type, 0), ""))
+ else if (type->num_fields () == 1 && streq (TYPE_FIELD_NAME (type, 0), ""))
{
/* Smash this type to be a structure type. We have to do this
because the type has already been recorded. */
struct type *field_type = TYPE_FIELD_TYPE (type, 0);
const char *variant_name
- = rust_last_path_segment (TYPE_NAME (field_type));
+ = rust_last_path_segment (field_type->name ());
TYPE_FIELD_NAME (type, 0) = variant_name;
- TYPE_NAME (field_type)
- = rust_fully_qualify (&objfile->objfile_obstack,
- TYPE_NAME (type), variant_name);
+ field_type->set_name
+ (rust_fully_qualify (&objfile->objfile_obstack,
+ type->name (), variant_name));
}
else
{
struct type *disr_type = nullptr;
- for (int i = 0; i < TYPE_NFIELDS (type); ++i)
+ for (int i = 0; i < type->num_fields (); ++i)
{
disr_type = TYPE_FIELD_TYPE (type, i);
- if (TYPE_CODE (disr_type) != TYPE_CODE_STRUCT)
+ if (disr_type->code () != TYPE_CODE_STRUCT)
{
/* All fields of a true enum will be structs. */
return;
}
- else if (TYPE_NFIELDS (disr_type) == 0)
+ else if (disr_type->num_fields () == 0)
{
/* Could be data-less variant, so keep going. */
disr_type = nullptr;
type->set_code (TYPE_CODE_STRUCT);
/* Make space for the discriminant field. */
- struct field *disr_field = &TYPE_FIELD (disr_type, 0);
+ struct field *disr_field = &disr_type->field (0);
field *new_fields
- = (struct field *) TYPE_ZALLOC (type, (TYPE_NFIELDS (type)
+ = (struct field *) TYPE_ZALLOC (type, ((type->num_fields () + 1)
* sizeof (struct field)));
- memcpy (new_fields + 1, TYPE_FIELDS (type),
- TYPE_NFIELDS (type) * sizeof (struct field));
- TYPE_FIELDS (type) = new_fields;
- TYPE_NFIELDS (type) = TYPE_NFIELDS (type) + 1;
+ memcpy (new_fields + 1, type->fields (),
+ type->num_fields () * sizeof (struct field));
+ type->set_fields (new_fields);
+ type->set_num_fields (type->num_fields () + 1);
/* Install the discriminant at index 0 in the union. */
- TYPE_FIELD (type, 0) = *disr_field;
+ type->field (0) = *disr_field;
TYPE_FIELD_ARTIFICIAL (type, 0) = 1;
TYPE_FIELD_NAME (type, 0) = "<<discriminant>>";
variant name. For convenience we build a map here. */
struct type *enum_type = FIELD_TYPE (*disr_field);
std::unordered_map<std::string, ULONGEST> discriminant_map;
- for (int i = 0; i < TYPE_NFIELDS (enum_type); ++i)
+ for (int i = 0; i < enum_type->num_fields (); ++i)
{
if (TYPE_FIELD_LOC_KIND (enum_type, i) == FIELD_LOC_KIND_ENUMVAL)
{
}
}
- int n_fields = TYPE_NFIELDS (type);
+ int n_fields = type->num_fields ();
/* We don't need a range entry for the discriminant, but we do
need one for every other field, as there is no default
variant. */
That name can be used to look up the correct
discriminant. */
const char *variant_name
- = rust_last_path_segment (TYPE_NAME (TYPE_FIELD_TYPE (type, i)));
+ = rust_last_path_segment (TYPE_FIELD_TYPE (type, i)->name ());
auto iter = discriminant_map.find (variant_name);
if (iter != discriminant_map.end ())
/* Remove the discriminant field, if it exists. */
struct type *sub_type = TYPE_FIELD_TYPE (type, i);
- if (TYPE_NFIELDS (sub_type) > 0)
+ if (sub_type->num_fields () > 0)
{
- --TYPE_NFIELDS (sub_type);
- ++TYPE_FIELDS (sub_type);
+ sub_type->set_num_fields (sub_type->num_fields () - 1);
+ sub_type->set_fields (sub_type->fields () + 1);
}
TYPE_FIELD_NAME (type, i) = variant_name;
- TYPE_NAME (sub_type)
- = rust_fully_qualify (&objfile->objfile_obstack,
- TYPE_NAME (type), variant_name);
+ sub_type->set_name
+ (rust_fully_qualify (&objfile->objfile_obstack,
+ type->name (), variant_name));
}
/* Indicate that this is a variant type. */
marks unnamed (and thus unused) parameters as
artificial; there is no way to differentiate
the two cases. */
- if (TYPE_NFIELDS (type) > 0
+ if (type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0)
- && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_PTR
+ && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR
&& TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type,
0))))
buf.puts (" const");
sect_offset sect_off = attr->get_ref_die_offset ();
type = get_die_type_at_offset (sect_off, cu->per_cu);
- if (type != NULL && TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
+ if (type != NULL && type->code () == TYPE_CODE_NAMESPACE)
{
/* This declaration is a global namespace alias. Add
a symbol for it whose type is the aliased namespace. */
if (child_die->tag == DW_TAG_template_type_param
|| child_die->tag == DW_TAG_template_value_param)
{
- templ_func = allocate_template_symbol (objfile);
+ templ_func = new (&objfile->objfile_obstack) template_symbol;
templ_func->subclass = SYMBOL_TEMPLATE;
break;
}
func_type = get_die_type (func_die, cu);
if (func_type != NULL)
{
- gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC);
+ gdb_assert (func_type->code () == TYPE_CODE_FUNC);
/* Enlist this call site to the function. */
call_site->tail_call_next = TYPE_TAIL_CALL_LIST (func_type);
{
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
- storage = new (&objfile->objfile_obstack) rust_vtable_symbol ();
- initialize_objfile_symbol (storage);
+ storage = new (&objfile->objfile_obstack) rust_vtable_symbol;
storage->concrete_type = containing_type;
storage->subclass = SYMBOL_RUST_VTABLE;
}
handle_data_member_location (die, cu, fp);
FIELD_BITSIZE (*fp) = 0;
FIELD_TYPE (*fp) = die_type (die, cu);
- FIELD_NAME (*fp) = TYPE_NAME (fp->type);
+ FIELD_NAME (*fp) = fp->type->name ();
}
else
gdb_assert_not_reached ("missing case in dwarf2_add_field");
/* Record the field count, allocate space for the array of fields,
and create blank accessibility bitfields if necessary. */
- TYPE_NFIELDS (type) = nfields;
- TYPE_FIELDS (type) = (struct field *)
- TYPE_ZALLOC (type, sizeof (struct field) * nfields);
+ type->set_num_fields (nfields);
+ type->set_fields
+ ((struct field *) TYPE_ZALLOC (type, sizeof (struct field) * nfields));
if (fip->non_public_fields && cu->language != language_ada)
{
= ((i < fip->baseclasses.size ()) ? fip->baseclasses[i]
: fip->fields[i - fip->baseclasses.size ()]);
- TYPE_FIELD (type, i) = field.field;
+ type->field (i) = field.field;
switch (field.accessibility)
{
case DW_ACCESS_private:
fnp->type = alloc_type (objfile);
this_type = read_type_die (die, cu);
- if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC)
+ if (this_type && this_type->code () == TYPE_CODE_FUNC)
{
- int nparams = TYPE_NFIELDS (this_type);
+ int nparams = this_type->num_fields ();
/* TYPE is the domain of this method, and THIS_TYPE is the type
of the method itself (TYPE_CODE_METHOD). */
smash_to_method_type (fnp->type, type,
TYPE_TARGET_TYPE (this_type),
- TYPE_FIELDS (this_type),
- TYPE_NFIELDS (this_type),
+ this_type->fields (),
+ this_type->num_fields (),
TYPE_VARARGS (this_type));
/* Handle static member functions.
/* If there is no `this' field and no DW_AT_containing_type,
we cannot actually find a base class context for the
vtable! */
- if (TYPE_NFIELDS (this_type) == 0
+ if (this_type->num_fields () == 0
|| !TYPE_FIELD_ARTIFICIAL (this_type, 0))
{
complaint (_("cannot determine context for virtual member "
struct type *pfn_type, *self_type, *new_type;
/* Check for a structure with no name and two children. */
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2)
+ if (type->code () != TYPE_CODE_STRUCT || type->num_fields () != 2)
return;
/* Check for __pfn and __delta members. */
/* Find the type of the method. */
pfn_type = TYPE_FIELD_TYPE (type, 0);
if (pfn_type == NULL
- || TYPE_CODE (pfn_type) != TYPE_CODE_PTR
- || TYPE_CODE (TYPE_TARGET_TYPE (pfn_type)) != TYPE_CODE_FUNC)
+ || pfn_type->code () != TYPE_CODE_PTR
+ || TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC)
return;
/* Look for the "this" argument. */
pfn_type = TYPE_TARGET_TYPE (pfn_type);
- if (TYPE_NFIELDS (pfn_type) == 0
+ if (pfn_type->num_fields () == 0
/* || TYPE_FIELD_TYPE (pfn_type, 0) == NULL */
- || TYPE_CODE (TYPE_FIELD_TYPE (pfn_type, 0)) != TYPE_CODE_PTR)
+ || TYPE_FIELD_TYPE (pfn_type, 0)->code () != TYPE_CODE_PTR)
return;
self_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0));
new_type = alloc_type (objfile);
smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type),
- TYPE_FIELDS (pfn_type), TYPE_NFIELDS (pfn_type),
+ pfn_type->fields (), pfn_type->num_fields (),
TYPE_VARARGS (pfn_type));
smash_to_methodptr_type (type, new_type);
}
if (get_die_type (die, cu) != NULL)
return get_die_type (die, cu);
- TYPE_NAME (type) = full_name;
+ type->set_name (full_name);
}
else
{
/* The name is already allocated along with this objfile, so
we don't need to duplicate it for the type. */
- TYPE_NAME (type) = name;
+ type->set_name (name);
}
}
int i;
/* Our own class provides vtbl ptr. */
- for (i = TYPE_NFIELDS (t) - 1;
+ for (i = t->num_fields () - 1;
i >= TYPE_N_BASECLASSES (t);
--i)
{
if (i < TYPE_N_BASECLASSES (t))
complaint (_("virtual function table pointer "
"not found when defining class '%s'"),
- TYPE_NAME (type) ? TYPE_NAME (type) : "");
+ type->name () ? type->name () : "");
}
else
{
int i;
- for (i = TYPE_NFIELDS (type) - 1;
+ for (i = type->num_fields () - 1;
i >= TYPE_N_BASECLASSES (type);
--i)
{
if (!fields.empty ())
{
- TYPE_NFIELDS (type) = fields.size ();
- TYPE_FIELDS (type) = (struct field *)
- TYPE_ALLOC (type, sizeof (struct field) * fields.size ());
- memcpy (TYPE_FIELDS (type), fields.data (),
+ type->set_num_fields (fields.size ());
+ type->set_fields
+ ((struct field *)
+ TYPE_ALLOC (type, sizeof (struct field) * fields.size ()));
+ memcpy (type->fields (), fields.data (),
sizeof (struct field) * fields.size ());
}
type->set_code (TYPE_CODE_ENUM);
name = dwarf2_full_name (NULL, die, cu);
if (name != NULL)
- TYPE_NAME (type) = name;
+ type->set_name (name);
attr = dwarf2_attr (die, DW_AT_type, cu);
if (attr != NULL)
name = dwarf2_name (die, cu);
if (name)
- TYPE_NAME (type) = name;
+ type->set_name (name);
maybe_set_alignment (cu, die, type);
std::vector<const char *> excludes;
add_using_directive (using_directives (cu),
- previous_prefix, TYPE_NAME (type), NULL,
+ previous_prefix, type->name (), NULL,
NULL, excludes, 0, &objfile->objfile_obstack);
}
}
if (type)
return type;
- if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_METHOD)
+ if (check_typedef (to_type)->code () == TYPE_CODE_METHOD)
type = lookup_methodptr_type (to_type);
- else if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_FUNC)
+ else if (check_typedef (to_type)->code () == TYPE_CODE_FUNC)
{
struct type *new_type
= alloc_type (cu->per_cu->dwarf2_per_objfile->objfile);
smash_to_method_type (new_type, domain, TYPE_TARGET_TYPE (to_type),
- TYPE_FIELDS (to_type), TYPE_NFIELDS (to_type),
+ to_type->fields (), to_type->num_fields (),
TYPE_VARARGS (to_type));
type = lookup_methodptr_type (new_type);
}
base_type = copy_type (base_type);
inner_array = base_type;
- while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY)
+ while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY)
{
TYPE_TARGET_TYPE (inner_array) =
copy_type (TYPE_TARGET_TYPE (inner_array));
/* In case the const qualifier is applied to an array type, the element type
is so qualified, not the array type (section 6.7.3 of C99). */
- if (TYPE_CODE (base_type) == TYPE_CODE_ARRAY)
+ if (base_type->code () == TYPE_CODE_ARRAY)
return add_array_cv_type (die, cu, base_type, 1, 0);
cv_type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0);
/* In case the volatile qualifier is applied to an array type, the
element type is so qualified, not the array type (section 6.7.3
of C99). */
- if (TYPE_CODE (base_type) == TYPE_CODE_ARRAY)
+ if (base_type->code () == TYPE_CODE_ARRAY)
return add_array_cv_type (die, cu, base_type, 0, 1);
cv_type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0);
}
/* Allocate storage for parameters and fill them in. */
- TYPE_NFIELDS (ftype) = nparams;
- TYPE_FIELDS (ftype) = (struct field *)
- TYPE_ZALLOC (ftype, nparams * sizeof (struct field));
+ ftype->set_num_fields (nparams);
+ ftype->set_fields
+ ((struct field *) TYPE_ZALLOC (ftype, nparams * sizeof (struct field)));
/* TYPE_FIELD_TYPE must never be NULL. Pre-fill the array to ensure it
even if we error out during the parameters reading below. */
if (tt != nullptr && TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits)
tt = nullptr;
- const char *name = (tt == nullptr) ? nullptr : TYPE_NAME (tt);
+ const char *name = (tt == nullptr) ? nullptr : tt->name ();
return dwarf2_init_float_type (objfile, bits, name, name_hint, byte_order);
}
case DW_ATE_complex_float:
type = dwarf2_init_complex_target_type (cu, objfile, bits / 2, name,
byte_order);
- if (TYPE_CODE (type) == TYPE_CODE_ERROR)
+ if (type->code () == TYPE_CODE_ERROR)
{
if (name == nullptr)
{
struct obstack *obstack
= &cu->per_cu->dwarf2_per_objfile->objfile->objfile_obstack;
- name = obconcat (obstack, "_Complex ", TYPE_NAME (type),
+ name = obconcat (obstack, "_Complex ", type->name (),
nullptr);
}
type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
GCC produces an empty range DIE.
FIXME: muller/2010-05-28: Possible references to object for low bound,
high bound or count are not yet handled by this code. */
- if (TYPE_CODE (index_type) == TYPE_CODE_VOID)
+ if (index_type->code () == TYPE_CODE_VOID)
index_type = cu->per_cu->addr_sized_int_type (false);
return index_type;
name = dwarf2_name (die, cu);
if (name)
- TYPE_NAME (range_type) = name;
+ range_type->set_name (name);
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr != nullptr)
type = init_type (cu->per_cu->dwarf2_per_objfile->objfile, TYPE_CODE_VOID,0,
NULL);
- TYPE_NAME (type) = dwarf2_name (die, cu);
+ type->set_name (dwarf2_name (die, cu));
/* In Ada, an unspecified type is typically used when the description
of the type is deferred to a different unit. When encountering
if (space)
sym = space;
else
- sym = allocate_symbol (objfile);
+ sym = new (&objfile->objfile_obstack) symbol;
OBJSTAT (objfile, n_syms++);
/* Cache this symbol's name and the name's demangled form (if any). */
/* Compilation with minimal debug info may result in
variables with missing type entries. Change the
misleading `void' type to something sensible. */
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID)
+ if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID)
SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int;
attr = dwarf2_attr (die, DW_AT_const_value, cu);
/* The symbol's name is already allocated along
with this objfile, so we don't need to
duplicate it for the type. */
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
- TYPE_NAME (SYMBOL_TYPE (sym)) = sym->search_name ();
+ if (SYMBOL_TYPE (sym)->name () == 0)
+ SYMBOL_TYPE (sym)->set_name (sym->search_name ());
}
}
}
DW_TAG_namespace DIEs with a name of "::" for the global namespace.
Work around this problem here. */
if (cu->language == language_cplus
- && strcmp (TYPE_NAME (parent_type), "::") == 0)
+ && strcmp (parent_type->name (), "::") == 0)
return "";
/* We give a name to even anonymous namespaces. */
- return TYPE_NAME (parent_type);
+ return parent_type->name ();
case DW_TAG_class_type:
case DW_TAG_interface_type:
case DW_TAG_structure_type:
case DW_TAG_union_type:
case DW_TAG_module:
parent_type = read_type_die (parent, cu);
- if (TYPE_NAME (parent_type) != NULL)
- return TYPE_NAME (parent_type);
+ if (parent_type->name () != NULL)
+ return parent_type->name ();
else
/* An anonymous structure is only allowed non-static data
members; no typedefs, no member functions, et cetera.
parent_type = read_type_die (parent, cu);
if (TYPE_DECLARED_CLASS (parent_type))
{
- if (TYPE_NAME (parent_type) != NULL)
- return TYPE_NAME (parent_type);
+ if (parent_type->name () != NULL)
+ return parent_type->name ();
return "";
}
/* Fall through. */
But this is not a problem, because the gnat-specific information
is actually not needed for these types. */
if (need_gnat_info (cu)
- && TYPE_CODE (type) != TYPE_CODE_FUNC
- && TYPE_CODE (type) != TYPE_CODE_FLT
- && TYPE_CODE (type) != TYPE_CODE_METHODPTR
- && TYPE_CODE (type) != TYPE_CODE_MEMBERPTR
- && TYPE_CODE (type) != TYPE_CODE_METHOD
+ && type->code () != TYPE_CODE_FUNC
+ && type->code () != TYPE_CODE_FLT
+ && type->code () != TYPE_CODE_METHODPTR
+ && type->code () != TYPE_CODE_MEMBERPTR
+ && type->code () != TYPE_CODE_METHOD
&& !HAVE_GNAT_AUX_INFO (type))
INIT_GNAT_SPECIFIC (type);