aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-01-22 12:23:53 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2021-01-22 12:23:53 -0500
commit344e9841d989cb96316d8d487e004212d4d3090a (patch)
treed8a7b89648a9463e2acbb0037740bf55149bc5a2 /gdb
parent30625020198359db7462a197380c242d91c07f14 (diff)
downloadgdb-344e9841d989cb96316d8d487e004212d4d3090a.zip
gdb-344e9841d989cb96316d8d487e004212d4d3090a.tar.gz
gdb-344e9841d989cb96316d8d487e004212d4d3090a.tar.bz2
gdb: remove TYPE_OBJFILE macro
Change all users to use the type::objfile method instead. gdb/ChangeLog: * gdbtypes.h (TYPE_OBJFILE): Remove, change all users to use the type::objfile method instead. Change-Id: I6b3f580913fb1fb0cf986b176dba8db68e1fabf9
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-lang.c4
-rw-r--r--gdb/gdbtypes.c26
-rw-r--r--gdb/gdbtypes.h6
-rw-r--r--gdb/guile/scm-type.c4
-rw-r--r--gdb/parse.c7
-rw-r--r--gdb/python/py-type.c10
-rw-r--r--gdb/rust-lang.c2
-rw-r--r--gdb/value.c6
9 files changed, 35 insertions, 35 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 400a42f..df54d9a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
+ * gdbtypes.h (TYPE_OBJFILE): Remove, change all users to use the
+ type::objfile method instead.
+
+2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
+
* gdbtypes.h (TYPE_OBJFILE_OWNED): Remove, update all users to
use the type::is_objfile_owned method.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c898ccb..e2befe1 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13253,8 +13253,8 @@ ada_operator_check (struct expression *exp, int pos,
/* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */
- if (type && TYPE_OBJFILE (type)
- && (*objfile_func) (TYPE_OBJFILE (type), data))
+ if (type != nullptr && type->objfile () != nullptr
+ && objfile_func (type->objfile (), data))
return 1;
return 0;
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index a4ae0d7..115f078 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -293,7 +293,7 @@ alloc_type_instance (struct type *oldtype)
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);
@@ -648,7 +648,7 @@ make_qualified_type (struct type *type, type_instance_flags new_flags,
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);
@@ -738,7 +738,7 @@ make_cv_type (int cnst, int voltl,
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,
@@ -804,7 +804,7 @@ replace_type (struct type *ntype, struct type *type)
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);
@@ -1681,7 +1681,7 @@ type_name_or_error (struct 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>");
@@ -2027,7 +2027,7 @@ get_vptr_fieldno (struct type *type, struct type **basetypep)
{
/* 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);
@@ -2800,7 +2800,7 @@ type::add_dyn_prop (dynamic_prop_node_kind prop_kind, dynamic_prop prop)
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;
@@ -2969,7 +2969,7 @@ check_typedef (struct type *type)
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;
@@ -2995,7 +2995,7 @@ check_typedef (struct type *type)
/* 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
@@ -5497,7 +5497,7 @@ copy_type_recursive (struct objfile *objfile,
/* 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);
@@ -5667,7 +5667,7 @@ copy_type (const struct type *type)
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;
@@ -5963,9 +5963,9 @@ allocate_fixed_point_type_info (struct type *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));
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 9037f41..30e8ac5 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -220,12 +220,6 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
#define TYPE_NOTTEXT(t) (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_NOTTEXT)
-/* * Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by
- the objfile retrieved as TYPE_OBJFILE. Otherwise, the type is
- owned by an architecture; TYPE_OBJFILE is NULL in this case. */
-
-#define TYPE_OBJFILE(t) ((t)->objfile ())
-
/* * True if this type was declared using the "class" keyword. This is
only valid for C++ structure and enum types. If false, a structure
was declared as a "struct"; if true it was declared "class". For
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 86f701f..936639c 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -151,7 +151,7 @@ tyscm_eq_type_smob (const void *ap, const void *bp)
static htab_t
tyscm_type_map (struct type *type)
{
- struct objfile *objfile = TYPE_OBJFILE (type);
+ struct objfile *objfile = type->objfile ();
htab_t htab;
if (objfile == NULL)
@@ -351,7 +351,7 @@ tyscm_copy_type_recursive (void **slot, void *info)
{
type_smob *t_smob = (type_smob *) *slot;
htab_t copied_types = (htab_t) info;
- struct objfile *objfile = TYPE_OBJFILE (t_smob->type);
+ struct objfile *objfile = t_smob->type->objfile ();
htab_t htab;
eqable_gdb_smob **new_slot;
type_smob t_smob_for_lookup;
diff --git a/gdb/parse.c b/gdb/parse.c
index b3cd91d..7fd5204 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1320,7 +1320,7 @@ operator_check_standard (struct expression *exp, int pos,
for (arg = 0; arg < nargs; arg++)
{
struct type *inst_type = elts[pos + 3 + arg].type;
- struct objfile *inst_objfile = TYPE_OBJFILE (inst_type);
+ struct objfile *inst_objfile = inst_type->objfile ();
if (inst_objfile && (*objfile_func) (inst_objfile, data))
return 1;
@@ -1351,9 +1351,10 @@ operator_check_standard (struct expression *exp, int pos,
/* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */
- if (type && TYPE_OBJFILE (type)
- && (*objfile_func) (TYPE_OBJFILE (type), data))
+ if (type != nullptr && type->objfile () != nullptr
+ && objfile_func (type->objfile (), data))
return 1;
+
if (objfile && (*objfile_func) (objfile, data))
return 1;
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index f05c3bc..878304f 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -418,7 +418,7 @@ static PyObject *
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;
@@ -1098,9 +1098,9 @@ set_type (type_object *obj, struct type *type)
{
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));
@@ -1119,10 +1119,10 @@ typy_dealloc (PyObject *obj)
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);
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index e9827ff..fc572ce 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1825,7 +1825,7 @@ rust_operator_check (struct expression *exp, int pos,
case OP_AGGREGATE:
{
struct type *type = exp->elts[pos + 1].type;
- struct objfile *objfile = TYPE_OBJFILE (type);
+ struct objfile *objfile = type->objfile ();
if (objfile != NULL && (*objfile_func) (objfile, data))
return 1;
diff --git a/gdb/value.c b/gdb/value.c
index c84698d..6f4ee54 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2514,10 +2514,10 @@ void
preserve_one_value (struct value *value, struct objfile *objfile,
htab_t copied_types)
{
- if (TYPE_OBJFILE (value->type) == objfile)
+ if (value->type->objfile () == objfile)
value->type = copy_type_recursive (objfile, value->type, copied_types);
- if (TYPE_OBJFILE (value->enclosing_type) == objfile)
+ if (value->enclosing_type->objfile () == objfile)
value->enclosing_type = copy_type_recursive (objfile,
value->enclosing_type,
copied_types);
@@ -2532,7 +2532,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile,
switch (var->kind)
{
case INTERNALVAR_INTEGER:
- if (var->u.integer.type && TYPE_OBJFILE (var->u.integer.type) == objfile)
+ if (var->u.integer.type && var->u.integer.type->objfile () == objfile)
var->u.integer.type
= copy_type_recursive (objfile, var->u.integer.type, copied_types);
break;