From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id F2FF9385B525; Mon, 13 Feb 2023 22:31:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2FF9385B525 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676327487; bh=9X/uuC5TrKo3zIZVfuSTFL7p+2NZTH0TJp0s6KXCzas=; h=From:To:Subject:Date:From; b=UKJzzsbNIcjuF6c/C2j7gHNdBX9mlSlo/DDnLu4RWctsmn0/PeZqppYPVJ61KnYSc bLA8pINRTsO+aqaCBsIpVFo592Y3f/gfLcH8l7bmq4q/TITTMy6xej6DrabR2/0yME GQDS9dCH8u+HGJ5W4DsqDmbIzgE+PQWr10XcJscQ= 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] Rely on value_ref_ptr::operator-> X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 736355f2e186a6a5275cac26d9486a5cc28f755c X-Git-Newrev: f28085dfb40901f064bd24a0030d9d73babe161e Message-Id: <20230213223127.F2FF9385B525@sourceware.org> Date: Mon, 13 Feb 2023 22:31:27 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df28085dfb409= 01f064bd24a0030d9d73babe161e commit f28085dfb40901f064bd24a0030d9d73babe161e Author: Tom Tromey Date: Fri Feb 10 10:48:50 2023 -0700 Rely on value_ref_ptr::operator-> =20 Simon pointed out some spots were doing val.get()->mumble, where val is a value_ref_ptr. These were introduced by the function-to-method script, replacing older code that passed the result of .get() to a function. =20 Now that value.h is using methods, we can instead rely on operator->. This patch replaces all the newly-introduced instances of this. =20 Approved-By: Simon Marchi Diff: --- gdb/ada-varobj.c | 2 +- gdb/breakpoint.c | 4 ++-- gdb/c-varobj.c | 4 ++-- gdb/printcmd.c | 4 ++-- gdb/value.c | 14 +++++++------- gdb/varobj.c | 14 +++++++------- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c index 63e851e7ae5..d4db032cbc1 100644 --- a/gdb/ada-varobj.c +++ b/gdb/ada-varobj.c @@ -943,7 +943,7 @@ static bool ada_value_is_changeable_p (const struct varobj *var) { struct type *type =3D (var->value !=3D nullptr - ? var->value.get ()->type () : var->type); + ? var->value->type () : var->type); =20 if (type->code () =3D=3D TYPE_CODE_REF) type =3D type->target_type (); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index ebb28432cab..3b9aebc5605 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4415,7 +4415,7 @@ bpstat::bpstat (const bpstat &other) print_it (other.print_it) { if (other.old_val !=3D NULL) - old_val =3D release_value (other.old_val.get ()->copy ()); + old_val =3D release_value (other.old_val->copy ()); } =20 /* Return a copy of a bpstat. Like "bs1 =3D bs2" but all storage that @@ -10316,7 +10316,7 @@ watch_command_1 (const char *arg, int accessflag, i= nt from_tty, w->cond_exp_valid_block =3D cond_exp_valid_block; if (just_location) { - struct type *t =3D val.get ()->type (); + struct type *t =3D val->type (); CORE_ADDR addr =3D value_as_address (val.get ()); =20 w->exp_string_reparse diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index 3e3919a65c0..ef4d0bd5047 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -506,14 +506,14 @@ c_value_of_variable (const struct varobj *var, } else { - if (var->not_fetched && var->value.get ()->lazy ()) + if (var->not_fetched && var->value->lazy ()) /* Frozen variable and no value yet. We don't implicitly fetch the value. MI response will use empty string for the value, which is OK. */ return std::string (); =20 gdb_assert (varobj_value_is_changeable_p (var)); - gdb_assert (!var->value.get ()->lazy ()); + gdb_assert (!var->value->lazy ()); =20 /* If the specified format is the current one, we can reuse print_value. */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 13945abc36c..df47bccc326 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1934,7 +1934,7 @@ x_command (const char *exp, int from_tty) /* Make last address examined available to the user as $_. Use the correct pointer type. */ struct type *pointer_type - =3D lookup_pointer_type (last_examine_value.get ()->type ()); + =3D lookup_pointer_type (last_examine_value->type ()); set_internalvar (lookup_internalvar ("_"), value_from_pointer (pointer_type, last_examine_address)); @@ -1943,7 +1943,7 @@ x_command (const char *exp, int from_tty) as $__. If the last value has not been fetched from memory then don't fetch it now; instead mark it by voiding the $__ variable. */ - if (last_examine_value.get ()->lazy ()) + if (last_examine_value->lazy ()) clear_internalvar (lookup_internalvar ("__")); else set_internalvar (lookup_internalvar ("__"), last_examine_value.get ()); diff --git a/gdb/value.c b/gdb/value.c index 0adf6faa152..7873aeb9558 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1347,7 +1347,7 @@ value::address () const if (m_lval !=3D lval_memory) return 0; if (m_parent !=3D NULL) - return m_parent.get ()->address () + m_offset; + return m_parent->address () + m_offset; if (NULL !=3D TYPE_DATA_LOCATION (type ())) { gdb_assert (PROP_CONST =3D=3D TYPE_DATA_LOCATION_KIND (type ())); @@ -1707,7 +1707,7 @@ access_value_history (int num) =20 absnum--; =20 - return value_history[absnum].get ()->copy (); + return value_history[absnum]->copy (); } =20 /* See value.h. */ @@ -2400,7 +2400,7 @@ preserve_one_varobj (struct varobj *varobj, struct ob= jfile *objfile, } =20 if (varobj->value !=3D nullptr) - varobj->value.get ()->preserve (objfile, copied_types); + varobj->value->preserve (objfile, copied_types); } =20 /* Update the internal variables and value history when OBJFILE is @@ -2419,7 +2419,7 @@ preserve_values (struct objfile *objfile) htab_up copied_types =3D create_copied_types_hash (); =20 for (const value_ref_ptr &item : value_history) - item.get ()->preserve (objfile, copied_types.get ()); + item->preserve (objfile, copied_types.get ()); =20 for (var =3D internalvars; var; var =3D var->next) preserve_one_internalvar (var, objfile, copied_types.get ()); @@ -4097,10 +4097,10 @@ test_value_copy () /* Verify that we can copy an entirely optimized out value, that may not= have its contents allocated. */ value_ref_ptr val =3D release_value (value::allocate_optimized_out (type= )); - value_ref_ptr copy =3D release_value (val.get ()->copy ()); + value_ref_ptr copy =3D release_value (val->copy ()); =20 - SELF_CHECK (val.get ()->entirely_optimized_out ()); - SELF_CHECK (copy.get ()->entirely_optimized_out ()); + SELF_CHECK (val->entirely_optimized_out ()); + SELF_CHECK (copy->entirely_optimized_out ()); } =20 } /* namespace selftests */ diff --git a/gdb/varobj.c b/gdb/varobj.c index 37b64a0c4bd..7f34cd01e26 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -504,7 +504,7 @@ varobj_set_display_format (struct varobj *var, } =20 if (varobj_value_is_changeable_p (var)=20 - && var->value !=3D nullptr && !var->value.get ()->lazy ()) + && var->value !=3D nullptr && !var->value->lazy ()) { var->print_value =3D varobj_value_get_print_value (var->value.get (), var->format, var); @@ -1007,7 +1007,7 @@ varobj_set_value (struct varobj *var, const char *exp= ression) gdb_assert (varobj_value_is_changeable_p (var)); =20 /* The value of a changeable variable object must not be lazy. */ - gdb_assert (!var->value.get ()->lazy ()); + gdb_assert (!var->value->lazy ()); =20 /* Need to coerce the input. We want to check if the value of the variable object will be different @@ -1312,7 +1312,7 @@ install_new_value (struct varobj *var, struct value *= value, bool initial) { /* Try to compare the values. That requires that both values are non-lazy. */ - if (var->not_fetched && var->value.get ()->lazy ()) + if (var->not_fetched && var->value->lazy ()) { /* This is a frozen varobj and the value was never read. Presumably, UI shows some "never read" indicator. @@ -1330,7 +1330,7 @@ install_new_value (struct varobj *var, struct value *= value, bool initial) } else { - gdb_assert (!var->value.get ()->lazy ()); + gdb_assert (!var->value->lazy ()); gdb_assert (!value->lazy ()); =20 gdb_assert (!var->print_value.empty () && !print_value.empty ()); @@ -1370,7 +1370,7 @@ install_new_value (struct varobj *var, struct value *= value, bool initial) } var->print_value =3D print_value; =20 - gdb_assert (var->value =3D=3D nullptr || var->value.get ()->type ()); + gdb_assert (var->value =3D=3D nullptr || var->value->type ()); =20 return changed; } @@ -1886,7 +1886,7 @@ varobj_get_value_type (const struct varobj *var) struct type *type; =20 if (var->value !=3D nullptr) - type =3D var->value.get ()->type (); + type =3D var->value->type (); else type =3D var->type; =20 @@ -2270,7 +2270,7 @@ varobj_editable_p (const struct varobj *var) struct type *type; =20 if (!(var->root->is_valid && var->value !=3D nullptr - && var->value.get ()->lval ())) + && var->value->lval ())) return false; =20 type =3D varobj_get_value_type (var);