We will fill it in later if we find out how. */
if (type == NULL)
{
- type = alloc_type (coffread_objfile);
+ type = type_allocator (coffread_objfile).new_type ();
*type_addr = type;
}
return type;
struct type *type;
uint32_t kind;
- type = alloc_type (of);
+ type = type_allocator (of).new_type ();
const char *name = ctf_type_name_raw (fp, tid);
if (name != nullptr && strlen (name) != 0)
ctf_funcinfo_t cfi;
uint32_t argc;
- type = alloc_type (of);
+ type = type_allocator (of).new_type ();
type->set_code (TYPE_CODE_FUNC);
if (ctf_func_type_info (fp, tid, &cfi) < 0)
ctf_dict_t *fp = ccp->fp;
struct type *type;
- type = alloc_type (of);
+ type = type_allocator (of).new_type ();
const char *name = ctf_type_name_raw (fp, tid);
if (name != nullptr && strlen (name) != 0)
struct type *type;
uint32_t kind;
- type = alloc_type (of);
+ type = type_allocator (of).new_type ();
const char *name = ctf_type_name_raw (fp, tid);
if (name != nullptr && strlen (name) != 0)
fnp->physname = physname ? physname : "";
}
- fnp->type = alloc_type (objfile);
+ fnp->type = type_allocator (objfile).new_type ();
this_type = read_type_die (die, cu);
if (this_type && this_type->code () == TYPE_CODE_FUNC)
{
return;
self_type = pfn_type->field (0).type ()->target_type ();
- new_type = alloc_type (objfile);
+ new_type = type_allocator (objfile).new_type ();
smash_to_method_type (new_type, self_type, pfn_type->target_type (),
pfn_type->fields (), pfn_type->num_fields (),
pfn_type->has_varargs ());
return set_die_type (die, type, cu);
}
- type = alloc_type (objfile);
+ type = type_allocator (objfile).new_type ();
INIT_CPLUS_SPECIFIC (type);
name = dwarf2_name (die, cu);
return set_die_type (die, type, cu);
}
- type = alloc_type (objfile);
+ type = type_allocator (objfile).new_type ();
type->set_code (TYPE_CODE_ENUM);
name = dwarf2_full_name (NULL, die, cu);
range_fields[i + 1].set_name (objfile->intern (name));
}
- struct type *bounds = alloc_type (objfile);
+ struct type *bounds = type_allocator (objfile).new_type ();
bounds->set_code (TYPE_CODE_STRUCT);
bounds->set_num_fields (range_fields.size ());
iter = iter->target_type ();
}
- struct type *result = alloc_type (objfile);
+ struct type *result = type_allocator (objfile).new_type ();
result->set_code (TYPE_CODE_STRUCT);
result->set_num_fields (2);
type = lookup_methodptr_type (to_type);
else if (check_typedef (to_type)->code () == TYPE_CODE_FUNC)
{
- struct type *new_type = alloc_type (cu->per_objfile->objfile);
+ struct type *new_type
+ = type_allocator (cu->per_objfile->objfile).new_type ();
smash_to_method_type (new_type, domain, to_type->target_type (),
to_type->fields (), to_type->num_fields (),
return type;
}
-/* Allocate a new OBJFILE-associated type structure and fill it
- with some defaults. Space for the type structure is allocated
- on the objfile's objfile_obstack. */
-
-struct type *
-alloc_type (struct objfile *objfile)
-{
- struct type *type;
-
- gdb_assert (objfile != NULL);
-
- /* Alloc the structure and start off with all fields zeroed. */
- type = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct type);
- TYPE_MAIN_TYPE (type) = OBSTACK_ZALLOC (&objfile->objfile_obstack,
- struct main_type);
- OBJSTAT (objfile, n_types++);
-
- type->set_owner (objfile);
-
- /* Initialize the fields that might not be zero. */
-
- type->set_code (TYPE_CODE_UNDEF);
- TYPE_CHAIN (type) = type; /* Chain back to itself. */
-
- return type;
-}
-
/* See gdbtypes.h. */
type *
{
struct type *type;
- type = alloc_type (objfile);
+ type = type_allocator (objfile).new_type ();
set_type_code (type, code);
gdb_assert ((bit % TARGET_CHAR_BIT) == 0);
type->set_length (bit / TARGET_CHAR_BIT);
#define TYPE_ZALLOC(t,size) (memset (TYPE_ALLOC (t, size), 0, size))
-/* Use alloc_type to allocate a type owned by an objfile. */
-extern struct type *alloc_type (struct objfile *);
-
/* * This returns the target type (or NULL) of TYPE, also skipping
past typedefs. */
{
struct type *t;
- t = alloc_type (mdebugread_objfile);
+ t = type_allocator (mdebugread_objfile).new_type ();
t->set_name (name);
INIT_CPLUS_SPECIFIC (t);
return t;
if (typenums[0] == -1)
{
- return (alloc_type (objfile));
+ return type_allocator (objfile).new_type ();
}
type_addr = dbx_lookup_type (typenums, objfile);
We will fill it in later if we find out how. */
if (*type_addr == 0)
{
- *type_addr = alloc_type (objfile);
+ *type_addr = type_allocator (objfile).new_type ();
}
return (*type_addr);