if (!oldtype->is_objfile_owned ())
type = GDBARCH_OBSTACK_ZALLOC (get_type_arch (oldtype), struct type);
else
- type = OBSTACK_ZALLOC (&TYPE_OBJFILE (oldtype)->objfile_obstack,
+ type = OBSTACK_ZALLOC (&oldtype->objfile ()->objfile_obstack,
struct type);
TYPE_MAIN_TYPE (type) = TYPE_MAIN_TYPE (oldtype);
as TYPE. Otherwise, we can't link it into TYPE's cv chain:
if one objfile is freed and the other kept, we'd have
dangling pointers. */
- gdb_assert (TYPE_OBJFILE (type) == TYPE_OBJFILE (storage));
+ gdb_assert (type->objfile () == storage->objfile ());
ntype = storage;
TYPE_MAIN_TYPE (ntype) = TYPE_MAIN_TYPE (type);
can't have inter-objfile pointers. The only thing to do is
to leave stub types as stub types, and look them up afresh by
name each time you encounter them. */
- gdb_assert (TYPE_OBJFILE (*typeptr) == TYPE_OBJFILE (type));
+ gdb_assert ((*typeptr)->objfile () == type->objfile ());
}
ntype = make_qualified_type (type, new_flags,
the assignment of one type's main type structure to the other
will produce a type with references to objects (names; field
lists; etc.) allocated on an objfile other than its own. */
- gdb_assert (TYPE_OBJFILE (ntype) == TYPE_OBJFILE (type));
+ gdb_assert (ntype->objfile () == type->objfile ());
*TYPE_MAIN_TYPE (ntype) = *TYPE_MAIN_TYPE (type);
return name;
name = saved_type->name ();
- objfile = TYPE_OBJFILE (saved_type);
+ objfile = saved_type->objfile ();
error (_("Invalid anonymous type %s [in module %s], GCC PR debug/47510 bug?"),
name ? name : "<anonymous>",
objfile ? objfile_name (objfile) : "<arch>");
{
/* If the type comes from a different objfile we can't cache
it, it may have a different lifetime. PR 2384 */
- if (TYPE_OBJFILE (type) == TYPE_OBJFILE (basetype))
+ if (type->objfile () == basetype->objfile ())
{
set_type_vptr_fieldno (type, fieldno);
set_type_vptr_basetype (type, basetype);
gdb_assert (this->is_objfile_owned ());
- temp = XOBNEW (&TYPE_OBJFILE (this)->objfile_obstack,
+ temp = XOBNEW (&this->objfile ()->objfile_obstack,
struct dynamic_prop_list);
temp->prop_kind = prop_kind;
temp->prop = prop;
TYPE's objfile is pointless, too, since you'll have to
move over any other types NEWTYPE refers to, which could
be an unbounded amount of stuff. */
- if (TYPE_OBJFILE (newtype) == TYPE_OBJFILE (type))
+ if (newtype->objfile () == type->objfile ())
type = make_qualified_type (newtype, type->instance_flags (), type);
else
type = newtype;
/* Same as above for opaque types, we can replace the stub
with the complete type only if they are in the same
objfile. */
- if (TYPE_OBJFILE (SYMBOL_TYPE (sym)) == TYPE_OBJFILE (type))
+ if (SYMBOL_TYPE (sym)->objfile () == type->objfile ())
type = make_qualified_type (SYMBOL_TYPE (sym),
type->instance_flags (), type);
else
/* This type shouldn't be pointing to any types in other objfiles;
if it did, the type might disappear unexpectedly. */
- gdb_assert (TYPE_OBJFILE (type) == objfile);
+ gdb_assert (type->objfile () == objfile);
struct type_pair pair (type, nullptr);
sizeof (struct main_type));
if (type->main_type->dyn_prop_list != NULL)
new_type->main_type->dyn_prop_list
- = copy_dynamic_prop_list (&TYPE_OBJFILE (type) -> objfile_obstack,
+ = copy_dynamic_prop_list (&type->objfile ()->objfile_obstack,
type->main_type->dyn_prop_list);
return new_type;
if (type->is_objfile_owned ())
{
fixed_point_type_storage *storage
- = fixed_point_objfile_key.get (TYPE_OBJFILE (type));
+ = fixed_point_objfile_key.get (type->objfile ());
if (storage == nullptr)
- storage = fixed_point_objfile_key.emplace (TYPE_OBJFILE (type));
+ storage = fixed_point_objfile_key.emplace (type->objfile ());
info = up.get ();
storage->push_back (std::move (up));
}
typy_get_objfile (PyObject *self, void *closure)
{
struct type *type = ((type_object *) self)->type;
- struct objfile *objfile = TYPE_OBJFILE (type);
+ struct objfile *objfile = type->objfile ();
if (objfile == nullptr)
Py_RETURN_NONE;
{
obj->type = type;
obj->prev = NULL;
- if (type && TYPE_OBJFILE (type))
+ if (type != nullptr && type->objfile () != nullptr)
{
- struct objfile *objfile = TYPE_OBJFILE (type);
+ struct objfile *objfile = type->objfile ();
obj->next = ((type_object *)
objfile_data (objfile, typy_objfile_data_key));
if (type->prev)
type->prev->next = type->next;
- else if (type->type && TYPE_OBJFILE (type->type))
+ else if (type->type != nullptr && type->type->objfile () != nullptr)
{
/* Must reset head of list. */
- struct objfile *objfile = TYPE_OBJFILE (type->type);
+ struct objfile *objfile = type->type->objfile ();
if (objfile)
set_objfile_data (objfile, typy_objfile_data_key, type->next);