From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 818743858D1E; Mon, 13 Feb 2023 22:28:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 818743858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676327320; bh=AYXbmVA5jwGupzX9lYYEpLiO6ZcMX61e3PdKTeW1APw=; h=From:To:Subject:Date:From; b=Z/75ad9CcXlT+XrjC4b0hunnggadrsjDXV/GfqeJYXmBlUZ9k05RBNwCVs/RfHpSN rytuRu0NSDj9KB5TWTQccn4ioIxsVMEO9g13ELubENXOEUCBdli56cEGGNZ0VzDXAi 6aBGCBAX7Yrr/Rq5AjVjp9pF0AEnVLdBr+f3ksFA= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Turn value_computed_closure and value_computed_funcs functions into methods X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: c8580184bbd1af58769d143b23d254737b08de9d X-Git-Newrev: b9f74d5432ffeef0e2281cb09c28d4b6d0371603 Message-Id: <20230213222840.818743858D1E@sourceware.org> Date: Mon, 13 Feb 2023 22:28:40 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db9f74d5432ff= eef0e2281cb09c28d4b6d0371603 commit b9f74d5432ffeef0e2281cb09c28d4b6d0371603 Author: Tom Tromey Date: Tue Jan 31 12:12:39 2023 -0700 Turn value_computed_closure and value_computed_funcs functions into met= hods =20 This changes the value_computed_funcs and value_computed_closure functions to be methods of value. =20 Approved-By: Simon Marchi Diff: --- gdb/dwarf2/expr.c | 12 ++++++------ gdb/dwarf2/loc.c | 6 +++--- gdb/opencl-lang.c | 10 +++++----- gdb/valops.c | 4 ++-- gdb/value.c | 18 +++++++++--------- gdb/value.h | 18 +++++++++--------- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 292ac8bb559..8d845e892e3 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -149,7 +149,7 @@ rw_pieced_value (value *v, value *from, bool check_opti= mized) gdb_byte *v_contents; const gdb_byte *from_contents; piece_closure *c - =3D (piece_closure *) value_computed_closure (v); + =3D (piece_closure *) v->computed_closure (); gdb::byte_vector buffer; bool bits_big_endian =3D type_byte_order (v->type ()) =3D=3D BFD_ENDIAN_= BIG; =20 @@ -463,7 +463,7 @@ static int check_pieced_synthetic_pointer (const value *value, LONGEST bit_offset, int bit_length) { - piece_closure *c =3D (piece_closure *) value_computed_closure (value); + piece_closure *c =3D (piece_closure *) value->computed_closure (); int i; =20 bit_offset +=3D 8 * value->offset (); @@ -503,7 +503,7 @@ static value * indirect_pieced_value (value *value) { piece_closure *c - =3D (piece_closure *) value_computed_closure (value); + =3D (piece_closure *) value->computed_closure (); int i; dwarf_expr_piece *piece =3D NULL; =20 @@ -580,7 +580,7 @@ coerce_pieced_ref (const value *value) TARGET_CHAR_BIT * type->length ())) { const piece_closure *closure - =3D (piece_closure *) value_computed_closure (value); + =3D (piece_closure *) value->computed_closure (); frame_info_ptr frame =3D get_selected_frame (_("No frame selected.")); =20 @@ -604,7 +604,7 @@ coerce_pieced_ref (const value *value) static void * copy_pieced_value_closure (const value *v) { - piece_closure *c =3D (piece_closure *) value_computed_closure (v); + piece_closure *c =3D (piece_closure *) v->computed_closure (); =20 ++c->refc; return c; @@ -613,7 +613,7 @@ copy_pieced_value_closure (const value *v) static void free_pieced_value_closure (value *v) { - piece_closure *c =3D (piece_closure *) value_computed_closure (v); + piece_closure *c =3D (piece_closure *) v->computed_closure (); =20 --c->refc; if (c->refc =3D=3D 0) diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index e5b35b8aadb..e975f280cfc 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -1279,7 +1279,7 @@ entry_data_value_coerce_ref (const struct value *valu= e) if (!TYPE_IS_REFERENCE (checked_type)) return NULL; =20 - target_val =3D (struct value *) value_computed_closure (value); + target_val =3D (struct value *) value->computed_closure (); value_incref (target_val); return target_val; } @@ -1289,7 +1289,7 @@ entry_data_value_coerce_ref (const struct value *valu= e) static void * entry_data_value_copy_closure (const struct value *v) { - struct value *target_val =3D (struct value *) value_computed_closure (v); + struct value *target_val =3D (struct value *) v->computed_closure (); =20 value_incref (target_val); return target_val; @@ -1300,7 +1300,7 @@ entry_data_value_copy_closure (const struct value *v) static void entry_data_value_free_closure (struct value *v) { - struct value *target_val =3D (struct value *) value_computed_closure (v); + struct value *target_val =3D (struct value *) v->computed_closure (); =20 value_decref (target_val); } diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 8c59e823d5c..f7a22b35931 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -119,7 +119,7 @@ allocate_lval_closure (int *indices, int n, struct valu= e *val) static void lval_func_read (struct value *v) { - struct lval_closure *c =3D (struct lval_closure *) value_computed_closur= e (v); + struct lval_closure *c =3D (struct lval_closure *) v->computed_closure (= ); struct type *type =3D check_typedef (v->type ()); struct type *eltype =3D check_typedef (c->val->type ())->target_type (); LONGEST offset =3D v->offset (); @@ -149,7 +149,7 @@ lval_func_write (struct value *v, struct value *fromval) { scoped_value_mark mark; =20 - struct lval_closure *c =3D (struct lval_closure *) value_computed_closur= e (v); + struct lval_closure *c =3D (struct lval_closure *) v->computed_closure (= ); struct type *type =3D check_typedef (v->type ()); struct type *eltype =3D check_typedef (c->val->type ())->target_type (); LONGEST offset =3D v->offset (); @@ -194,7 +194,7 @@ static int lval_func_check_synthetic_pointer (const struct value *v, LONGEST offset, int length) { - struct lval_closure *c =3D (struct lval_closure *) value_computed_closur= e (v); + struct lval_closure *c =3D (struct lval_closure *) v->computed_closure (= ); /* Size of the target type in bits. */ int elsize =3D check_typedef (c->val->type ())->target_type ()->length () * 8; @@ -227,7 +227,7 @@ lval_func_check_synthetic_pointer (const struct value *= v, static void * lval_func_copy_closure (const struct value *v) { - struct lval_closure *c =3D (struct lval_closure *) value_computed_closur= e (v); + struct lval_closure *c =3D (struct lval_closure *) v->computed_closure (= ); =20 ++c->refc; =20 @@ -237,7 +237,7 @@ lval_func_copy_closure (const struct value *v) static void lval_func_free_closure (struct value *v) { - struct lval_closure *c =3D (struct lval_closure *) value_computed_closur= e (v); + struct lval_closure *c =3D (struct lval_closure *) v->computed_closure (= ); =20 --c->refc; =20 diff --git a/gdb/valops.c b/gdb/valops.c index 7e3fca30af2..0d321e81027 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1273,7 +1273,7 @@ value_assign (struct value *toval, struct value *from= val) =20 case lval_computed: { - const struct lval_funcs *funcs =3D value_computed_funcs (toval); + const struct lval_funcs *funcs =3D toval->computed_funcs (); =20 if (funcs->write !=3D NULL) { @@ -1639,7 +1639,7 @@ value_ind (struct value *arg1) =20 if (VALUE_LVAL (arg1) =3D=3D lval_computed) { - const struct lval_funcs *funcs =3D value_computed_funcs (arg1); + const struct lval_funcs *funcs =3D arg1->computed_funcs (); =20 if (funcs->indirect) { diff --git a/gdb/value.c b/gdb/value.c index b09ee9bd2d4..b26d4cd8f11 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1383,19 +1383,19 @@ value_bits_synthetic_pointer (const struct value *v= alue, } =20 const struct lval_funcs * -value_computed_funcs (const struct value *v) +value::computed_funcs () const { - gdb_assert (value_lval_const (v) =3D=3D lval_computed); + gdb_assert (m_lval =3D=3D lval_computed); =20 - return v->m_location.computed.funcs; + return m_location.computed.funcs; } =20 void * -value_computed_closure (const struct value *v) +value::computed_closure () const { - gdb_assert (v->m_lval =3D=3D lval_computed); + gdb_assert (m_lval =3D=3D lval_computed); =20 - return v->m_location.computed.closure; + return m_location.computed.closure; } =20 enum lval_type * @@ -3697,7 +3697,7 @@ coerce_ref_if_computed (const struct value *arg) if (value_lval_const (arg) !=3D lval_computed) return NULL; =20 - funcs =3D value_computed_funcs (arg); + funcs =3D arg->computed_funcs (); if (funcs->coerce_ref =3D=3D NULL) return NULL; =20 @@ -4025,8 +4025,8 @@ value_fetch_lazy (struct value *val) else if (VALUE_LVAL (val) =3D=3D lval_register) value_fetch_lazy_register (val); else if (VALUE_LVAL (val) =3D=3D lval_computed - && value_computed_funcs (val)->read !=3D NULL) - value_computed_funcs (val)->read (val); + && val->computed_funcs ()->read !=3D NULL) + val->computed_funcs ()->read (val); else internal_error (_("Unexpected lazy value type.")); =20 diff --git a/gdb/value.h b/gdb/value.h index 73783f8c3a5..a0455ed5809 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -301,6 +301,15 @@ struct value void set_stack (int val) { m_stack =3D val; } =20 + /* If this value is lval_computed, return its lval_funcs + structure. */ + const struct lval_funcs *computed_funcs () const; + + /* If this value is lval_computed, return its closure. The meaning + of the returned value depends on the functions this value + uses. */ + void *computed_closure () const; + =20 /* Type of value; either not an lval, or one of the various different possible kinds of lval. */ @@ -565,15 +574,6 @@ extern struct value *allocate_computed_value (struct t= ype *type, =20 extern struct value *allocate_optimized_out_value (struct type *type); =20 -/* If VALUE is lval_computed, return its lval_funcs structure. */ - -extern const struct lval_funcs *value_computed_funcs (const struct value *= ); - -/* If VALUE is lval_computed, return its closure. The meaning of the - returned value depends on the functions VALUE uses. */ - -extern void *value_computed_closure (const struct value *value); - /* Throw an error complaining that the value has been optimized out. */