/* Alloc the structure and start off with all fields zeroed. */
struct type *type = OBSTACK_ZALLOC (obstack, struct type);
- TYPE_MAIN_TYPE (type) = OBSTACK_ZALLOC (obstack, struct main_type);
- TYPE_MAIN_TYPE (type)->m_lang = m_lang;
+ type->main_type = OBSTACK_ZALLOC (obstack, struct main_type);
+ type->main_type->m_lang = m_lang;
if (m_is_objfile)
{
type = OBSTACK_ZALLOC (&oldtype->objfile_owner ()->objfile_obstack,
struct type);
- TYPE_MAIN_TYPE (type) = TYPE_MAIN_TYPE (oldtype);
+ type->main_type = oldtype->main_type;
TYPE_CHAIN (type) = type; /* Chain back to itself for now. */
objfile *objfile = type->objfile_owner ();
gdbarch *arch = type->arch_owner ();
- memset (TYPE_MAIN_TYPE (type), 0, sizeof (struct main_type));
+ memset (type->main_type, 0, sizeof (struct main_type));
/* Restore owner information. */
if (objfile_owned)
gdb_assert (type->objfile_owner () == storage->objfile_owner ());
ntype = storage;
- TYPE_MAIN_TYPE (ntype) = TYPE_MAIN_TYPE (type);
+ ntype->main_type = type->main_type;
TYPE_CHAIN (ntype) = ntype;
}
lists; etc.) allocated on an objfile other than its own. */
gdb_assert (ntype->objfile_owner () == type->objfile_owner ());
- *TYPE_MAIN_TYPE (ntype) = *TYPE_MAIN_TYPE (type);
+ *ntype->main_type = *type->main_type;
/* The type length is not a part of the main type. Update it for
each type on the variant chain. */
if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE)
return NULL;
gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_SELF_TYPE);
- return TYPE_MAIN_TYPE (type)->type_specific.self_type;
+ return type->main_type->type_specific.self_type;
case TYPE_CODE_METHOD:
if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE)
return NULL;
gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
- return TYPE_MAIN_TYPE (type)->type_specific.func_stuff->self_type;
+ return type->main_type->type_specific.func_stuff->self_type;
default:
gdb_assert_not_reached ("bad type");
}
if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE)
TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_SELF_TYPE;
gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_SELF_TYPE);
- TYPE_MAIN_TYPE (type)->type_specific.self_type = self_type;
+ type->main_type->type_specific.self_type = self_type;
break;
case TYPE_CODE_METHOD:
if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE)
INIT_FUNC_SPECIFIC (type);
gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
- TYPE_MAIN_TYPE (type)->type_specific.func_stuff->self_type = self_type;
+ type->main_type->type_specific.func_stuff->self_type = self_type;
break;
default:
gdb_assert_not_reached ("bad type");
struct type *dynamic_array_type = type;
type = copy_type (dynamic_array_type->target_type ());
struct dynamic_prop_list *prop_list
- = TYPE_MAIN_TYPE (dynamic_array_type)->dyn_prop_list;
+ = dynamic_array_type->main_type->dyn_prop_list;
if (prop_list != nullptr)
{
struct obstack *obstack
= &type->objfile_owner ()->objfile_obstack;
- TYPE_MAIN_TYPE (type)->dyn_prop_list
+ type->main_type->dyn_prop_list
= copy_dynamic_prop_list (obstack, prop_list);
}
return type;
t->set_is_unsigned (true);
TYPE_SPECIFIC_FIELD (t) = TYPE_SPECIFIC_INT;
- TYPE_MAIN_TYPE (t)->type_specific.int_stuff.bit_size = bit;
- TYPE_MAIN_TYPE (t)->type_specific.int_stuff.bit_offset = 0;
+ t->main_type->type_specific.int_stuff.bit_size = bit;
+ t->main_type->type_specific.int_stuff.bit_offset = 0;
return t;
}
t->set_is_unsigned (true);
TYPE_SPECIFIC_FIELD (t) = TYPE_SPECIFIC_INT;
- TYPE_MAIN_TYPE (t)->type_specific.int_stuff.bit_size = bit;
- TYPE_MAIN_TYPE (t)->type_specific.int_stuff.bit_offset = 0;
+ t->main_type->type_specific.int_stuff.bit_size = bit;
+ t->main_type->type_specific.int_stuff.bit_offset = 0;
return t;
}
gdb_assert (can_create_complex_type (target_type));
- if (TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type == nullptr)
+ if (target_type->main_type->flds_bnds.complex_type == nullptr)
{
if (name == nullptr && target_type->name () != nullptr)
{
t->set_name (name);
t->set_target_type (target_type);
- TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type = t;
+ target_type->main_type->flds_bnds.complex_type = t;
}
- return TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type;
+ return target_type->main_type->flds_bnds.complex_type;
}
/* See gdbtypes.h. */
int
class_types_same_p (const struct type *a, const struct type *b)
{
- return (TYPE_MAIN_TYPE (a) == TYPE_MAIN_TYPE (b)
+ return (a->main_type == b->main_type
|| (a->name () != nullptr
&& b->name () != nullptr
&& streq (a->name (), b->name ())));
/* Copy the common fields of types. For the main type, we simply
copy the entire thing and then update specific fields as needed. */
- *TYPE_MAIN_TYPE (new_type) = *TYPE_MAIN_TYPE (type);
+ *new_type->main_type = *type->main_type;
new_type->set_owner (type->arch ());
break;
case TYPE_SPECIFIC_INT:
TYPE_SPECIFIC_FIELD (new_type) = TYPE_SPECIFIC_INT;
- TYPE_MAIN_TYPE (new_type)->type_specific.int_stuff
- = TYPE_MAIN_TYPE (type)->type_specific.int_stuff;
+ new_type->main_type->type_specific.int_stuff
+ = type->main_type->type_specific.int_stuff;
break;
default:
struct type *new_type = this->new_type ();
new_type->set_instance_flags (type->instance_flags ());
new_type->set_length (type->length ());
- memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type),
+ memcpy (new_type->main_type, type->main_type,
sizeof (struct main_type));
/* This might have been overwritten by the memcpy. */
#define INIT_FUNC_SPECIFIC(type) \
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC, \
- TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *) \
+ (type)->main_type->type_specific.func_stuff = (struct func_type *) \
TYPE_ZALLOC (type, \
- sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
+ sizeof (*(type)->main_type->type_specific.func_stuff)))
/* "struct fixed_point_type_info" has a field that has a destructor.
See allocate_fixed_point_type_info to understand how this is
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
allocate_fixed_point_type_info (type))
-#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
#define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
#define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
#define TYPE_SPECIFIC_FIELD(thistype) \
- TYPE_MAIN_TYPE(thistype)->type_specific_field
+ (thistype)->main_type->type_specific_field
/* We need this tap-dance with the TYPE_RAW_SPECIFIC because of the case
where we're trying to print an Ada array using the C language.
In that case, there is no "cplus_stuff", but the C language assumes
(!HAVE_CPLUS_STRUCT(thistype) \
? (struct cplus_struct_type*)&cplus_struct_default \
: TYPE_RAW_CPLUS_SPECIFIC(thistype))
-#define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
+#define TYPE_RAW_CPLUS_SPECIFIC(thistype) (thistype)->main_type->type_specific.cplus_stuff
#define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
- TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
-#define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
-#define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
+ (thistype)->main_type->type_specific.cplus_stuff->calling_convention
+#define TYPE_FLOATFORMAT(thistype) (thistype)->main_type->type_specific.floatformat
+#define TYPE_GNAT_SPECIFIC(thistype) (thistype)->main_type->type_specific.gnat_stuff
#define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
-#define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
-#define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn
-#define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
+#define TYPE_CALLING_CONVENTION(thistype) (thistype)->main_type->type_specific.func_stuff->calling_convention
+#define TYPE_NO_RETURN(thistype) (thistype)->main_type->type_specific.func_stuff->is_noreturn
+#define TYPE_TAIL_CALL_LIST(thistype) (thistype)->main_type->type_specific.func_stuff->tail_call_list
#define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
#define TYPE_BASECLASS_NAME(thistype,index) (thistype->field (index).name ())