From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 3A0E73858D1E; Mon, 13 Feb 2023 22:30:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A0E73858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676327437; bh=96MsDqSUzan4OwRmZBFyQrUYLSy8Ed7PT8R/oI5w01E=; h=From:To:Subject:Date:From; b=twARom5PbIGYO//C2iyAHlZ0oZyv9q5wb50uV866511uxpuww8fVvXxBHFAb2DltB U5g7OTIfVssEUQGzFm/ca5eciWdg9dBdP8L8CzdsgN696I/UnxNssNcV1b872jNFN/ U/lslVatSYjV2NIARtU0gDD1C52Y57ZjZ+U2lXYM= 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] Change some code to use value methods X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 8181b7b65787041f16d08a5619789cece42b2553 X-Git-Newrev: fcf86fe5977ec47a0a6e32be9c1434ac808e2c4e Message-Id: <20230213223037.3A0E73858D1E@sourceware.org> Date: Mon, 13 Feb 2023 22:30:37 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dfcf86fe5977e= c47a0a6e32be9c1434ac808e2c4e commit fcf86fe5977ec47a0a6e32be9c1434ac808e2c4e Author: Tom Tromey Date: Tue Jan 31 20:54:26 2023 -0700 Change some code to use value methods =20 A few functions in value.c were accessing the internal fields of struct value. However, in these cases it seemed simpler to change them to use the public API rather than convert them to be methods. =20 Approved-By: Simon Marchi Diff: --- gdb/value.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gdb/value.c b/gdb/value.c index 0fcd8a85f23..73c3eaf4659 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2092,7 +2092,7 @@ value_of_internalvar (struct gdbarch *gdbarch, struct= internalvar *var) want. */ =20 if (var->kind !=3D INTERNALVAR_MAKE_VALUE - && val->m_lval !=3D lval_computed) + && val->lval () !=3D lval_computed) { VALUE_LVAL (val) =3D lval_internalvar; VALUE_INTERNALVAR (val) =3D var; @@ -2904,15 +2904,15 @@ value_primitive_field (struct value *arg1, LONGEST = offset, LONGEST container_bitsize =3D type->length () * 8; =20 v =3D value::allocate_lazy (type); - v->m_bitsize =3D TYPE_FIELD_BITSIZE (arg_type, fieldno); - if ((bitpos % container_bitsize) + v->m_bitsize <=3D container_bitsi= ze + v->set_bitsize (TYPE_FIELD_BITSIZE (arg_type, fieldno)); + if ((bitpos % container_bitsize) + v->bitsize () <=3D container_bits= ize && type->length () <=3D (int) sizeof (LONGEST)) - v->m_bitpos =3D bitpos % container_bitsize; + v->set_bitpos (bitpos % container_bitsize); else - v->m_bitpos =3D bitpos % 8; - v->m_offset =3D (arg1->embedded_offset () - + offset - + (bitpos - v->m_bitpos) / 8); + v->set_bitpos (bitpos % 8); + v->set_offset ((arg1->embedded_offset () + + offset + + (bitpos - v->bitpos ()) / 8)); v->set_parent (arg1); if (!arg1->lazy ()) v->fetch_lazy (); @@ -2948,9 +2948,9 @@ value_primitive_field (struct value *arg1, LONGEST of= fset, value_contents_copy_raw (v, 0, arg1, 0, arg1->enclosing_type ()->length ()); } - v->m_type =3D type; - v->m_offset =3D arg1->offset (); - v->m_embedded_offset =3D offset + arg1->embedded_offset () + boffset; + v->deprecated_set_type (type); + v->set_offset (arg1->offset ()); + v->set_embedded_offset (offset + arg1->embedded_offset () + boffset); } else if (NULL !=3D TYPE_DATA_LOCATION (type)) { @@ -2982,8 +2982,8 @@ value_primitive_field (struct value *arg1, LONGEST of= fset, arg1, arg1->embedded_offset () + offset, type_length_units (type)); } - v->m_offset =3D (arg1->offset () + offset - + arg1->embedded_offset ()); + v->set_offset ((arg1->offset () + offset + + arg1->embedded_offset ())); } v->set_component_location (arg1); return v; @@ -3582,7 +3582,7 @@ value_from_component (struct value *whole, struct typ= e *type, LONGEST offset) whole, whole->embedded_offset () + offset, type_length_units (type)); } - v->m_offset =3D whole->offset () + offset + whole->embedded_offset (); + v->set_offset (whole->offset () + offset + whole->embedded_offset ()); v->set_component_location (whole); =20 return v;