aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-03-13 10:31:06 -0600
committerTom Tromey <tom@tromey.com>2023-03-18 11:12:37 -0600
commit2d39ccd3d1773b26ed8178bcd77375175c48ee62 (patch)
treee4634ee4c847ad5e71d092188c6f38ab21ae2444 /gdb/rust-lang.c
parent333859402c7968dc718dae73ca0fbddbe096fc51 (diff)
downloadbinutils-2d39ccd3d1773b26ed8178bcd77375175c48ee62.zip
binutils-2d39ccd3d1773b26ed8178bcd77375175c48ee62.tar.gz
binutils-2d39ccd3d1773b26ed8178bcd77375175c48ee62.tar.bz2
Unify arch_integer_type and init_integer_type
This unifies arch_integer_type and init_integer_type by using a type allocator. Reviewed-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/rust-lang.c')
-rw-r--r--gdb/rust-lang.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 82004da..608799c 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1594,27 +1594,28 @@ rust_language::language_arch_info (struct gdbarch *gdbarch,
return t;
};
+ type_allocator alloc (gdbarch);
struct type *bool_type
= add (arch_boolean_type (gdbarch, 8, 1, "bool"));
add (arch_character_type (gdbarch, 32, 1, "char"));
- add (arch_integer_type (gdbarch, 8, 0, "i8"));
+ add (init_integer_type (alloc, 8, 0, "i8"));
struct type *u8_type
- = add (arch_integer_type (gdbarch, 8, 1, "u8"));
- add (arch_integer_type (gdbarch, 16, 0, "i16"));
- add (arch_integer_type (gdbarch, 16, 1, "u16"));
- add (arch_integer_type (gdbarch, 32, 0, "i32"));
- add (arch_integer_type (gdbarch, 32, 1, "u32"));
- add (arch_integer_type (gdbarch, 64, 0, "i64"));
- add (arch_integer_type (gdbarch, 64, 1, "u64"));
+ = add (init_integer_type (alloc, 8, 1, "u8"));
+ add (init_integer_type (alloc, 16, 0, "i16"));
+ add (init_integer_type (alloc, 16, 1, "u16"));
+ add (init_integer_type (alloc, 32, 0, "i32"));
+ add (init_integer_type (alloc, 32, 1, "u32"));
+ add (init_integer_type (alloc, 64, 0, "i64"));
+ add (init_integer_type (alloc, 64, 1, "u64"));
unsigned int length = 8 * builtin->builtin_data_ptr->length ();
- add (arch_integer_type (gdbarch, length, 0, "isize"));
+ add (init_integer_type (alloc, length, 0, "isize"));
struct type *usize_type
- = add (arch_integer_type (gdbarch, length, 1, "usize"));
+ = add (init_integer_type (alloc, length, 1, "usize"));
add (arch_float_type (gdbarch, 32, "f32", floatformats_ieee_single));
add (arch_float_type (gdbarch, 64, "f64", floatformats_ieee_double));
- add (arch_integer_type (gdbarch, 0, 1, "()"));
+ add (init_integer_type (alloc, 0, 1, "()"));
struct type *tem = make_cv_type (1, 0, u8_type, NULL);
add (rust_slice_type ("&str", tem, usize_type));