@@ -568,7 +568,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
if (ischar)
type = init_character_type (alloc, TARGET_CHAR_BIT, !issigned, name);
else if (isbool)
- type = init_boolean_type (of, gdbarch_int_bit (gdbarch),
+ type = init_boolean_type (alloc, gdbarch_int_bit (gdbarch),
!issigned, name);
else
{
@@ -204,7 +204,7 @@ build_d_types (struct gdbarch *gdbarch)
type_allocator alloc (gdbarch);
builtin_d_type->builtin_void = builtin_type (gdbarch)->builtin_void;
builtin_d_type->builtin_bool
- = arch_boolean_type (gdbarch, 8, 1, "bool");
+ = init_boolean_type (alloc, 8, 1, "bool");
builtin_d_type->builtin_byte
= init_integer_type (alloc, 8, 0, "byte");
builtin_d_type->builtin_ubyte
@@ -15238,7 +15238,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
type = init_pointer_type (objfile, bits, name, type);
break;
case DW_ATE_boolean:
- type = init_boolean_type (objfile, bits, 1, name);
+ type = init_boolean_type (alloc, bits, 1, name);
break;
case DW_ATE_complex_float:
type = dwarf2_init_complex_target_type (cu, objfile, bits / 2, name,
@@ -1733,16 +1733,16 @@ build_fortran_types (struct gdbarch *gdbarch)
= alloc.new_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character");
builtin_f_type->builtin_logical_s1
- = arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "logical*1");
+ = init_boolean_type (alloc, TARGET_CHAR_BIT, 1, "logical*1");
builtin_f_type->builtin_logical_s2
- = arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1, "logical*2");
+ = init_boolean_type (alloc, gdbarch_short_bit (gdbarch), 1, "logical*2");
builtin_f_type->builtin_logical
- = arch_boolean_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "logical*4");
+ = init_boolean_type (alloc, gdbarch_int_bit (gdbarch), 1, "logical*4");
builtin_f_type->builtin_logical_s8
- = arch_boolean_type (gdbarch, gdbarch_long_long_bit (gdbarch), 1,
+ = init_boolean_type (alloc, gdbarch_long_long_bit (gdbarch), 1,
"logical*8");
builtin_f_type->builtin_integer_s1
@@ -3432,17 +3432,15 @@ init_character_type (type_allocator &alloc,
return t;
}
-/* Allocate a TYPE_CODE_BOOL type structure associated with OBJFILE.
- BIT is the type size in bits. If UNSIGNED_P is non-zero, set
- the type's TYPE_UNSIGNED flag. NAME is the type name. */
+/* See gdbtypes.h. */
struct type *
-init_boolean_type (struct objfile *objfile,
+init_boolean_type (type_allocator &alloc,
int bit, int unsigned_p, const char *name)
{
struct type *t;
- t = type_allocator (objfile).new_type (TYPE_CODE_BOOL, bit, name);
+ t = alloc.new_type (TYPE_CODE_BOOL, bit, name);
if (unsigned_p)
t->set_is_unsigned (true);
@@ -5748,23 +5746,6 @@ copy_type (const struct type *type)
/* Helper functions to initialize architecture-specific types. */
-/* Allocate a TYPE_CODE_BOOL type structure associated with GDBARCH.
- BIT is the type size in bits. If UNSIGNED_P is non-zero, set
- the type's TYPE_UNSIGNED flag. NAME is the type name. */
-
-struct type *
-arch_boolean_type (struct gdbarch *gdbarch,
- int bit, int unsigned_p, const char *name)
-{
- struct type *t;
-
- t = type_allocator (gdbarch).new_type (TYPE_CODE_BOOL, bit, name);
- if (unsigned_p)
- t->set_is_unsigned (true);
-
- return t;
-}
-
/* Allocate a TYPE_CODE_FLT type structure associated with GDBARCH.
BIT is the type size in bits; if BIT equals -1, the size is
determined by the floatformat. NAME is the type name. Set the
@@ -6103,7 +6084,7 @@ create_gdbtypes_data (struct gdbarch *gdbarch)
builtin_type->builtin_string
= alloc.new_type (TYPE_CODE_STRING, TARGET_CHAR_BIT, "string");
builtin_type->builtin_bool
- = arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "bool");
+ = init_boolean_type (alloc, TARGET_CHAR_BIT, 1, "bool");
/* The following three are about decimal floating point types, which
are 32-bits, 64-bits and 128-bits respectively. */
@@ -2307,8 +2307,14 @@ extern struct type *init_integer_type (type_allocator &, int, int,
extern struct type *init_character_type (type_allocator &, int, int,
const char *);
-extern struct type *init_boolean_type (struct objfile *, int, int,
+
+/* Allocate a TYPE_CODE_BOOL type structure using ALLOC. BIT is the
+ type size in bits. If UNSIGNED_P is non-zero, set the type's
+ TYPE_UNSIGNED flag. NAME is the type name. */
+
+extern struct type *init_boolean_type (type_allocator &, int, int,
const char *);
+
extern struct type *init_float_type (struct objfile *, int, const char *,
const struct floatformat **,
enum bfd_endian = BFD_ENDIAN_UNKNOWN);
@@ -2321,8 +2327,6 @@ extern struct type *init_fixed_point_type (struct objfile *, int, int,
const char *);
/* Helper functions to construct architecture-owned types. */
-extern struct type *arch_boolean_type (struct gdbarch *, int, int,
- const char *);
extern struct type *arch_float_type (struct gdbarch *, int, const char *,
const struct floatformat **);
extern struct type *arch_decfloat_type (struct gdbarch *, int, const char *);
@@ -488,7 +488,7 @@ build_go_types (struct gdbarch *gdbarch)
builtin_go_type->builtin_char
= init_character_type (alloc, 8, 1, "char");
builtin_go_type->builtin_bool
- = arch_boolean_type (gdbarch, 8, 0, "bool");
+ = init_boolean_type (alloc, 8, 0, "bool");
builtin_go_type->builtin_int
= init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "int");
builtin_go_type->builtin_uint
@@ -294,7 +294,7 @@ build_m2_types (struct gdbarch *gdbarch)
builtin_m2_type->builtin_char
= init_character_type (alloc, TARGET_CHAR_BIT, 1, "CHAR");
builtin_m2_type->builtin_bool
- = arch_boolean_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "BOOLEAN");
+ = init_boolean_type (alloc, gdbarch_int_bit (gdbarch), 1, "BOOLEAN");
return builtin_m2_type;
}
@@ -933,7 +933,7 @@ class opencl_language : public language_defn
el_type = add (arch_float_type (gdbarch, 64, "double", floatformats_ieee_double));
BUILD_OCL_VTYPES (double, el_type);
- add (arch_boolean_type (gdbarch, 8, 1, "bool"));
+ add (init_boolean_type (alloc, 8, 1, "bool"));
add (init_integer_type (alloc, 8, 1, "unsigned char"));
add (init_integer_type (alloc, 16, 1, "unsigned short"));
add (init_integer_type (alloc, 32, 1, "unsigned int"));
@@ -1596,7 +1596,7 @@ rust_language::language_arch_info (struct gdbarch *gdbarch,
type_allocator alloc (gdbarch);
struct type *bool_type
- = add (arch_boolean_type (gdbarch, 8, 1, "bool"));
+ = add (init_boolean_type (alloc, 8, 1, "bool"));
add (init_character_type (alloc, 32, 1, "char"));
add (init_integer_type (alloc, 8, 0, "i8"));
struct type *u8_type
@@ -2144,7 +2144,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
rettype = init_integer_type (alloc, 32, 0, "integer");
break;
case 16:
- rettype = init_boolean_type (objfile, 32, 1, "boolean");
+ rettype = init_boolean_type (alloc, 32, 1, "boolean");
break;
case 17:
rettype = init_float_type (objfile, 32, "short real",
@@ -2161,16 +2161,16 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
rettype = init_character_type (alloc, 8, 1, "character");
break;
case 21:
- rettype = init_boolean_type (objfile, 8, 1, "logical*1");
+ rettype = init_boolean_type (alloc, 8, 1, "logical*1");
break;
case 22:
- rettype = init_boolean_type (objfile, 16, 1, "logical*2");
+ rettype = init_boolean_type (alloc, 16, 1, "logical*2");
break;
case 23:
- rettype = init_boolean_type (objfile, 32, 1, "logical*4");
+ rettype = init_boolean_type (alloc, 32, 1, "logical*4");
break;
case 24:
- rettype = init_boolean_type (objfile, 32, 1, "logical");
+ rettype = init_boolean_type (alloc, 32, 1, "logical");
break;
case 25:
/* Complex type consisting of two IEEE single precision values. */
@@ -3759,7 +3759,7 @@ read_sun_builtin_type (const char **pp, int typenums[2], struct objfile *objfile
}
if (boolean_type)
- return init_boolean_type (objfile, type_bits, unsigned_type, NULL);
+ return init_boolean_type (alloc, type_bits, unsigned_type, NULL);
else
return init_integer_type (alloc, type_bits, unsigned_type, NULL);
}