From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from outbound-ss-761.bluehost.com (outbound-ss-761.bluehost.com [74.220.211.250]) by sourceware.org (Postfix) with ESMTPS id 8A3F03858428 for ; Fri, 10 Feb 2023 23:23:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A3F03858428 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw13.mail.unifiedlayer.com (unknown [10.0.90.128]) by progateway8.mail.pro1.eigbox.com (Postfix) with ESMTP id 0EAA9100612DD for ; Fri, 10 Feb 2023 23:23:30 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id QcjqpYDoQNX2aQcjqpJ7gB; Fri, 10 Feb 2023 23:23:30 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=NMAQR22g c=1 sm=1 tr=0 ts=63e6d1f2 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10:nop_charset_1 a=m04uMKEZRckA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=0Dut3KXhcsfYpNAOOBkA:9 a=QEXdDO2ut3YA:10:nop_charset_2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=V1p2EaPT26xa33dv2IgdEDjOM86ovXr1+UJVwm5iCxU=; b=Q3LVXIWEy9rnWEvY/FfD/9jpUy 4JN+vrP+KjD2Dg7V/NMvCI3uj8OHv2RdDAlb9VPOdwSsoQxYqAfvEieARB8ILXnV4pCZA35GgrD32 dPWHbnXmYmQ/da4Q4syAtzsuT; Received: from 75-166-130-93.hlrn.qwest.net ([75.166.130.93]:57244 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pQbJv-000WcR-Rf for gdb-patches@sourceware.org; Fri, 10 Feb 2023 14:52:39 -0700 From: Tom Tromey Date: Fri, 10 Feb 2023 14:53:06 -0700 Subject: [PATCH v2 48/48] Rely on value_ref_ptr::operator-> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230209-submit-value-fixups-2023-v2-48-b0b27fd97177@tromey.com> References: <20230209-submit-value-fixups-2023-v2-0-b0b27fd97177@tromey.com> In-Reply-To: <20230209-submit-value-fixups-2023-v2-0-b0b27fd97177@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.130.93 X-Source-L: No X-Exim-ID: 1pQbJv-000WcR-Rf X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-130-93.hlrn.qwest.net ([192.168.0.21]) [75.166.130.93]:57244 X-Source-Auth: tom+tromey.com X-Email-Count: 22 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3027.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. Now that value.h is using methods, we can instead rely on operator->. This patch replaces all the newly-introduced instances of this. --- 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 = (var->value != nullptr - ? var->value.get ()->type () : var->type); + ? var->value->type () : var->type); if (type->code () == TYPE_CODE_REF) type = type->target_type (); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 239926ffd4a..42bda879468 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4407,7 +4407,7 @@ bpstat::bpstat (const bpstat &other) print_it (other.print_it) { if (other.old_val != NULL) - old_val = release_value (other.old_val.get ()->copy ()); + old_val = release_value (other.old_val->copy ()); } /* Return a copy of a bpstat. Like "bs1 = bs2" but all storage that @@ -10285,7 +10285,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty, w->cond_exp_valid_block = cond_exp_valid_block; if (just_location) { - struct type *t = val.get ()->type (); + struct type *t = val->type (); CORE_ADDR addr = value_as_address (val.get ()); 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 (); gdb_assert (varobj_value_is_changeable_p (var)); - gdb_assert (!var->value.get ()->lazy ()); + gdb_assert (!var->value->lazy ()); /* If the specified format is the current one, we can reuse print_value. */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index c6b55e97f40..321d0a7b3ca 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1918,7 +1918,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 - = lookup_pointer_type (last_examine_value.get ()->type ()); + = lookup_pointer_type (last_examine_value->type ()); set_internalvar (lookup_internalvar ("_"), value_from_pointer (pointer_type, last_examine_address)); @@ -1927,7 +1927,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 23a0e4abd0f..799af142f2b 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1218,7 +1218,7 @@ value::address () const if (m_lval != lval_memory) return 0; if (m_parent != NULL) - return m_parent.get ()->address () + m_offset; + return m_parent->address () + m_offset; if (NULL != TYPE_DATA_LOCATION (type ())) { gdb_assert (PROP_CONST == TYPE_DATA_LOCATION_KIND (type ())); @@ -1547,7 +1547,7 @@ access_value_history (int num) absnum--; - return value_history[absnum].get ()->copy (); + return value_history[absnum]->copy (); } /* See value.h. */ @@ -2240,7 +2240,7 @@ preserve_one_varobj (struct varobj *varobj, struct objfile *objfile, } if (varobj->value != nullptr) - varobj->value.get ()->preserve (objfile, copied_types); + varobj->value->preserve (objfile, copied_types); } /* Update the internal variables and value history when OBJFILE is @@ -2259,7 +2259,7 @@ preserve_values (struct objfile *objfile) htab_up copied_types = create_copied_types_hash (); for (const value_ref_ptr &item : value_history) - item.get ()->preserve (objfile, copied_types.get ()); + item->preserve (objfile, copied_types.get ()); for (var = internalvars; var; var = var->next) preserve_one_internalvar (var, objfile, copied_types.get ()); @@ -3924,10 +3924,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 = release_value (value::allocate_optimized_out (type)); - value_ref_ptr copy = release_value (val.get ()->copy ()); + value_ref_ptr copy = release_value (val->copy ()); - 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 ()); } } /* 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, } if (varobj_value_is_changeable_p (var) - && var->value != nullptr && !var->value.get ()->lazy ()) + && var->value != nullptr && !var->value->lazy ()) { var->print_value = varobj_value_get_print_value (var->value.get (), var->format, var); @@ -1007,7 +1007,7 @@ varobj_set_value (struct varobj *var, const char *expression) gdb_assert (varobj_value_is_changeable_p (var)); /* The value of a changeable variable object must not be lazy. */ - gdb_assert (!var->value.get ()->lazy ()); + gdb_assert (!var->value->lazy ()); /* 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 ()); 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 = print_value; - gdb_assert (var->value == nullptr || var->value.get ()->type ()); + gdb_assert (var->value == nullptr || var->value->type ()); return changed; } @@ -1886,7 +1886,7 @@ varobj_get_value_type (const struct varobj *var) struct type *type; if (var->value != nullptr) - type = var->value.get ()->type (); + type = var->value->type (); else type = var->type; @@ -2270,7 +2270,7 @@ varobj_editable_p (const struct varobj *var) struct type *type; if (!(var->root->is_valid && var->value != nullptr - && var->value.get ()->lval ())) + && var->value->lval ())) return false; type = varobj_get_value_type (var); -- 2.39.1