From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by sourceware.org (Postfix) with ESMTPS id 634CD3858D28 for ; Tue, 15 Mar 2022 13:25:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 634CD3858D28 Received: by mail-io1-xd2a.google.com with SMTP id 195so22216433iou.0 for ; Tue, 15 Mar 2022 06:25:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fm9HmACsW4fUS3FizGL3IPEUKG2M3vOhE8+lnY/x1N8=; b=ZzMazwUShMv665mJSnkx/zPthSpMjrOU1FBm1CfRcY0qZIvcI7uLHTSQzuL1BjAWil 9pXPheqlObM0masLydoz/34Q9iBgeFRz4O7/gizEra2Djh+8rR1sJdrUCwOIhXOXeGMD fNnqhX2JhkI4s8tpTnPK6VOaHK9ROvuDJC5h3wm+f1MOgcMHRTQkl918VjDNrVyWzVLD MRsuZnmj/AKkv8HVR8BULXWhYh0d/hdbBF6mrb6Fjaz5h+i2UPuNLXdW/7Ds3h99gYJL Cu+aUkipgSqW+vCCrr3twIBQ+EP2MaLgtAg+M8CbX0J2Jka9VffcUXF3moF7xHIACFtL z6nQ== X-Gm-Message-State: AOAM532GZemVf4e64BRwdkltkPZ9Nhpn0bCW778wZi17SWklizXFqGTP 6uw+d7oxJOXU+n5LoJ6KZ24Jh3aR29pMww== X-Google-Smtp-Source: ABdhPJwAunbsf5Fh2t4oPLT1DKxByl8JlFrIEbMyihywjMBf+O7Wr08XbSjC6yFbgOldThYcDqwcpg== X-Received: by 2002:a05:6638:204:b0:319:1b34:1c57 with SMTP id e4-20020a056638020400b003191b341c57mr23462122jaq.80.1647350702707; Tue, 15 Mar 2022 06:25:02 -0700 (PDT) Received: from murgatroyd.Home (71-211-175-224.hlrn.qwest.net. [71.211.175.224]) by smtp.gmail.com with ESMTPSA id l14-20020a05660227ce00b00645ebb013c1sm10711430ios.45.2022.03.15.06.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Mar 2022 06:25:02 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/4] Remove eval_op_string Date: Tue, 15 Mar 2022 07:24:57 -0600 Message-Id: <20220315132500.1032991-2-tromey@adacore.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220315132500.1032991-1-tromey@adacore.com> References: <20220315132500.1032991-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2022 13:25:04 -0000 eval_op_string is only used in a single place -- the implementation of string_operation. This patch turns it into the string_operation::evaluate method, removing a bit of extraneous code. --- gdb/eval.c | 15 ++++++++++----- gdb/expop.h | 11 +---------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/gdb/eval.c b/gdb/eval.c index 6ced0b261e7..b7b8915fa89 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1078,17 +1078,22 @@ eval_op_register (struct type *expect_type, struct expression *exp, return val; } -/* Helper function that implements the body of OP_STRING. */ +namespace expr +{ -struct value * -eval_op_string (struct type *expect_type, struct expression *exp, - enum noside noside, int len, const char *string) +value * +string_operation::evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) { + const std::string &str = std::get<0> (m_storage); struct type *type = language_string_char_type (exp->language_defn, exp->gdbarch); - return value_string (string, len, type); + return value_string (str.c_str (), str.size (), type); } +} /* namespace expr */ + /* Helper function that implements the body of OP_OBJC_SELECTOR. */ struct value * diff --git a/gdb/expop.h b/gdb/expop.h index 58863b8f3ab..1592568a857 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -64,10 +64,6 @@ extern struct value *eval_op_func_static_var (struct type *expect_type, extern struct value *eval_op_register (struct type *expect_type, struct expression *exp, enum noside noside, const char *name); -extern struct value *eval_op_string (struct type *expect_type, - struct expression *exp, - enum noside noside, int len, - const char *string); extern struct value *eval_op_ternop (struct type *expect_type, struct expression *exp, enum noside noside, @@ -912,12 +908,7 @@ class string_operation value *evaluate (struct type *expect_type, struct expression *exp, - enum noside noside) override - { - const std::string &str = std::get<0> (m_storage); - return eval_op_string (expect_type, exp, noside, - str.size (), str.c_str ()); - } + enum noside noside) override; enum exp_opcode opcode () const override { return OP_STRING; } -- 2.34.1