summaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-03-13 12:53:48 -0600
committerTom Tromey <tom@tromey.com>2023-03-18 11:12:38 -0600
commite727c536c6e7334484b8dcbf369fe425bd5b892a (patch)
treee3a36d9571d8b5f0173d0c5c02c3712371ae00e0 /gdb/valops.c
parent9c794d2d46f0605ee033107418aac2ca20f659f8 (diff)
downloadbinutils-gdb-e727c536c6e7334484b8dcbf369fe425bd5b892a.tar.gz
Use type allocator for range types
This changes the range type creation functions to accept a type allocator, and updates all the callers. Note that symbol readers should generally allocate on the relevant objfile, regardless of the underlying type of the range, which is what this patch implements. Reviewed-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 2cef24fc4c5..f655427f7cc 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -485,7 +485,8 @@ value_cast (struct type *type, struct value *arg2)
"divide object size in cast"));
/* FIXME-type-allocation: need a way to free this type when
we are done with it. */
- range_type = create_static_range_type (NULL,
+ type_allocator alloc (range_type->target_type ());
+ range_type = create_static_range_type (alloc,
range_type->target_type (),
low_bound,
new_length + low_bound - 1);
@@ -4057,7 +4058,8 @@ value_slice (struct value *array, int lowbound, int length)
/* FIXME-type-allocation: need a way to free this type when we are
done with it. */
- slice_range_type = create_static_range_type (NULL,
+ type_allocator alloc (range_type->target_type ());
+ slice_range_type = create_static_range_type (alloc,
range_type->target_type (),
lowbound,
lowbound + length - 1);