From f29de665046c1b1a2feabf8d3d584b3b89699e10 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 31 Jan 2023 12:46:20 -0700 Subject: [PATCH] Turn more deprecated_* functions into methods This changes deprecated_value_internalvar_hack, deprecated_value_internalvar_hack, and deprecated_value_regnum_hack into methods on value. Approved-By: Simon Marchi --- gdb/value.c | 18 ++++++------------ gdb/value.h | 16 ++++++++++------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/gdb/value.c b/gdb/value.c index 5917ba53c9a..471a98f277b 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1429,24 +1429,18 @@ value::set_address (CORE_ADDR addr) m_location.address = addr; } -struct internalvar ** -deprecated_value_internalvar_hack (struct value *value) -{ - return &value->m_location.internalvar; -} - struct frame_id * -deprecated_value_next_frame_id_hack (struct value *value) +value::deprecated_next_frame_id_hack () { - gdb_assert (value->m_lval == lval_register); - return &value->m_location.reg.next_frame_id; + gdb_assert (m_lval == lval_register); + return &m_location.reg.next_frame_id; } int * -deprecated_value_regnum_hack (struct value *value) +value::deprecated_regnum_hack () { - gdb_assert (value->m_lval == lval_register); - return &value->m_location.reg.regnum; + gdb_assert (m_lval == lval_register); + return &m_location.reg.regnum; } diff --git a/gdb/value.h b/gdb/value.h index 6422cfb0df0..788a3d8514e 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -338,6 +338,13 @@ struct value /* Set the address of a value. */ void set_address (CORE_ADDR); + struct internalvar **deprecated_internalvar_hack () + { return &m_location.internalvar; } + + struct frame_id *deprecated_next_frame_id_hack (); + + int *deprecated_regnum_hack (); + /* Type of value; either not an lval, or one of the various different possible kinds of lval. */ @@ -692,19 +699,16 @@ extern void set_value_component_location (struct value *component, #define VALUE_LVAL(val) (*((val)->deprecated_lval_hack ())) /* Pointer to internal variable. */ -extern struct internalvar **deprecated_value_internalvar_hack (struct value *); -#define VALUE_INTERNALVAR(val) (*deprecated_value_internalvar_hack (val)) +#define VALUE_INTERNALVAR(val) (*((val)->deprecated_internalvar_hack ())) /* Frame ID of "next" frame to which a register value is relative. A register value is indicated by VALUE_LVAL being set to lval_register. So, if the register value is found relative to frame F, then the frame id of F->next will be stored in VALUE_NEXT_FRAME_ID. */ -extern struct frame_id *deprecated_value_next_frame_id_hack (struct value *); -#define VALUE_NEXT_FRAME_ID(val) (*deprecated_value_next_frame_id_hack (val)) +#define VALUE_NEXT_FRAME_ID(val) (*((val)->deprecated_next_frame_id_hack ())) /* Register number if the value is from a register. */ -extern int *deprecated_value_regnum_hack (struct value *); -#define VALUE_REGNUM(val) (*deprecated_value_regnum_hack (val)) +#define VALUE_REGNUM(val) (*((val)->deprecated_regnum_hack ())) /* Return value after lval_funcs->coerce_ref (after check_typedef). Return NULL if lval_funcs->coerce_ref is not applicable for whatever reason. */ -- 2.30.2