diff options
author | Tom Tromey <tom@tromey.com> | 2023-02-01 07:27:50 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-02-13 15:22:17 -0700 |
commit | 6c49729e593cd1577080b082be81fe113f8d7943 (patch) | |
tree | 689669836ab3ee33e0aa5d479de325d1a954d4d3 /gdb/valops.c | |
parent | e3fb3c4772d81a7deb26a3c1af253e9f01b07716 (diff) | |
download | gdb-6c49729e593cd1577080b082be81fe113f8d7943.zip gdb-6c49729e593cd1577080b082be81fe113f8d7943.tar.gz gdb-6c49729e593cd1577080b082be81fe113f8d7943.tar.bz2 |
Turn various value copying-related functions into methods
This patch turns a grab bag of value functions to methods of value.
These are done together because their implementations are
interrelated.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 89bd5c9..7197348 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1726,8 +1726,7 @@ value_array (int lowbound, int highbound, struct value **elemvec) { val = value::allocate (arraytype); for (idx = 0; idx < nelem; idx++) - value_contents_copy (val, idx * typelength, elemvec[idx], 0, - typelength); + elemvec[idx]->contents_copy (val, idx * typelength, 0, typelength); return val; } @@ -1736,7 +1735,7 @@ value_array (int lowbound, int highbound, struct value **elemvec) val = value::allocate (arraytype); for (idx = 0; idx < nelem; idx++) - value_contents_copy (val, idx * typelength, elemvec[idx], 0, typelength); + elemvec[idx]->contents_copy (val, idx * typelength, 0, typelength); return val; } @@ -2022,7 +2021,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset, if (field_is_static (&type->field (i))) v = value_static_field (type, i); else - v = value_primitive_field (arg1, offset, i, type); + v = arg1->primitive_field (offset, i, type); update_result (v, offset); return; @@ -2118,7 +2117,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset, search (v2, 0, TYPE_BASECLASS (type, i)); } else if (found_baseclass) - v = value_primitive_field (arg1, offset, i, type); + v = arg1->primitive_field (offset, i, type); else { search (arg1, offset + TYPE_BASECLASS_BITPOS (type, i) / 8, @@ -2467,7 +2466,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype, if (!field_is_static (&t->field (i)) && bitpos == t->field (i).loc_bitpos () && types_equal (ftype, t->field (i).type ())) - return value_primitive_field (*argp, 0, i, t); + return (*argp)->primitive_field (0, i, t); } error (_("No field with matching bitpos and type.")); @@ -4083,8 +4082,8 @@ value_slice (struct value *array, int lowbound, int length) else { slice = value::allocate (slice_type); - value_contents_copy (slice, 0, array, offset, - type_length_units (slice_type)); + array->contents_copy (slice, 0, offset, + type_length_units (slice_type)); } slice->set_component_location (array); |