Turn value_stack and set_value_stack functions into methods

This changes the value_stack and set_value_stack functions to be
methods of value.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey
2023-01-31 11:11:17 -07:00
parent 3ee3b2700d
commit c8580184bb
5 changed files with 10 additions and 19 deletions

View File

@ -1005,7 +1005,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
retval = value_at_lazy (subobj_type,
address + subobj_offset);
if (in_stack_memory)
set_value_stack (retval, 1);
retval->set_stack (1);
}
break;

View File

@ -289,7 +289,7 @@ frame_unwind_got_memory (frame_info_ptr frame, int regnum, CORE_ADDR addr)
struct gdbarch *gdbarch = frame_unwind_arch (frame);
struct value *v = value_at_lazy (register_type (gdbarch, regnum), addr);
set_value_stack (v, 1);
v->set_stack (1);
return v;
}

View File

@ -1376,7 +1376,7 @@ value_repeat (struct value *arg1, int count)
VALUE_LVAL (val) = lval_memory;
set_value_address (val, value_address (arg1));
read_value_memory (val, 0, value_stack (val), value_address (val),
read_value_memory (val, 0, val->stack (), value_address (val),
value_contents_all_raw (val).data (),
type_length_units (val->enclosing_type ()));

View File

@ -1291,18 +1291,6 @@ value_contents_copy (struct value *dst, LONGEST dst_offset,
value_contents_copy_raw (dst, dst_offset, src, src_offset, length);
}
int
value_stack (const struct value *value)
{
return value->m_stack;
}
void
set_value_stack (struct value *value, int val)
{
value->m_stack = val;
}
gdb::array_view<const gdb_byte>
value_contents (struct value *value)
{
@ -3886,7 +3874,7 @@ value_fetch_lazy_memory (struct value *val)
gdb_assert (len >= 0);
if (len > 0)
read_value_memory (val, 0, value_stack (val), addr,
read_value_memory (val, 0, val->stack (), addr,
value_contents_all_raw (val).data (), len);
}

View File

@ -295,6 +295,12 @@ struct value
void set_enclosing_type (struct type *new_type);
int stack () const
{ return m_stack; }
void set_stack (int val)
{ m_stack = val; }
/* Type of value; either not an lval, or one of the various
different possible kinds of lval. */
@ -568,9 +574,6 @@ extern const struct lval_funcs *value_computed_funcs (const struct value *);
extern void *value_computed_closure (const struct value *value);
extern int value_stack (const struct value *);
extern void set_value_stack (struct value *value, int val);
/* Throw an error complaining that the value has been optimized
out. */