aboutsummaryrefslogtreecommitdiff
path: root/gdb/mdebugread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-03-13 10:17:09 -0600
committerTom Tromey <tom@tromey.com>2023-03-18 11:12:37 -0600
commit333859402c7968dc718dae73ca0fbddbe096fc51 (patch)
tree787aebf74331ab0d4d49b51bb14dc376ff93a69f /gdb/mdebugread.c
parentcc495054ad5cd22cfc3b3de5fc962af7f6b4e8d5 (diff)
downloadbinutils-333859402c7968dc718dae73ca0fbddbe096fc51.zip
binutils-333859402c7968dc718dae73ca0fbddbe096fc51.tar.gz
binutils-333859402c7968dc718dae73ca0fbddbe096fc51.tar.bz2
Remove init_type
This removes init_type, replacing all uses with the new type allocator. Reviewed-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r--gdb/mdebugread.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 9e55999..209040b 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1386,6 +1386,8 @@ basic_type (int bt, struct objfile *objfile)
if (map_bt[bt])
return map_bt[bt];
+ type_allocator alloc (objfile);
+
switch (bt)
{
case btNil:
@@ -1457,14 +1459,14 @@ basic_type (int bt, struct objfile *objfile)
break;
case btFloatDec:
- tp = init_type (objfile, TYPE_CODE_ERROR,
- gdbarch_double_bit (gdbarch), "floating decimal");
+ tp = alloc.new_type (TYPE_CODE_ERROR,
+ gdbarch_double_bit (gdbarch), "floating decimal");
break;
case btString:
/* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
FIXME. */
- tp = init_type (objfile, TYPE_CODE_STRING, TARGET_CHAR_BIT, "string");
+ tp = alloc.new_type (TYPE_CODE_STRING, TARGET_CHAR_BIT, "string");
break;
case btVoid:
@@ -1573,6 +1575,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
}
}
+ type_allocator alloc (mdebugread_objfile);
+
/* Move on to next aux. */
ax++;
@@ -1647,7 +1651,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
/* Try to cross reference this type, build new type on failure. */
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
if (tp == NULL)
- tp = init_type (mdebugread_objfile, type_code, 0, NULL);
+ tp = alloc.new_type (type_code, 0, NULL);
/* DEC c89 produces cross references to qualified aggregate types,
dereference them. */
@@ -1705,7 +1709,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
/* Try to cross reference this type, build new type on failure. */
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
if (tp == NULL)
- tp = init_type (mdebugread_objfile, type_code, 0, NULL);
+ tp = alloc.new_type (type_code, 0, NULL);
/* Make sure that TYPE_CODE(tp) has an expected type code.
Any type may be returned from cross_ref if file indirect entries
@@ -4266,13 +4270,15 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
rf = rn->rfd;
}
+ type_allocator alloc (mdebugread_objfile);
+
/* mips cc uses a rf of -1 for opaque struct definitions.
Set TYPE_STUB for these types so that check_typedef will
resolve them if the struct gets defined in another compilation unit. */
if (rf == -1)
{
*pname = "<undefined>";
- *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
+ *tpp = alloc.new_type (type_code, 0, NULL);
(*tpp)->set_is_stub (true);
return result;
}
@@ -4358,7 +4364,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
switch (tir.bt)
{
case btVoid:
- *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
+ *tpp = alloc.new_type (type_code, 0, NULL);
*pname = "<undefined>";
break;
@@ -4392,7 +4398,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
default:
complaint (_("illegal bt %d in forward typedef for %s"), tir.bt,
sym_name);
- *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
+ *tpp = alloc.new_type (type_code, 0, NULL);
break;
}
return result;
@@ -4420,7 +4426,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
has not been parsed yet.
Initialize the type only, it will be filled in when
it's definition is parsed. */
- *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
+ *tpp = alloc.new_type (type_code, 0, NULL);
}
add_pending (fh, esh, *tpp);
}