From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway36.websitewelcome.com (gateway36.websitewelcome.com [50.116.126.2]) by sourceware.org (Postfix) with ESMTPS id 6F8443955406 for ; Sat, 20 Feb 2021 20:16:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6F8443955406 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 608AF400CA8C5 for ; Sat, 20 Feb 2021 14:16:36 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id DYg8lmU5TDT64DYg8lULgi; Sat, 20 Feb 2021 14:16:36 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: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=6B6UW5evkUvFByQKAvOHZ2y7D4v5l7bSLRakP+WLw5A=; b=Gl9M4DZ1PnQc9osUsfIE68xjHz PcE778rav3dfU0HmWMy8Z6EcRZr+t5kMqheprpCaJ4lQZKiX0SiS3pW6n/np4DK/U33pQv9J5LdOt /f4MiSRzmhSnWG2t14hSA3NRg; Received: from 97-122-70-152.hlrn.qwest.net ([97.122.70.152]:52692 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lDYg8-000GZH-4A for gdb-patches@sourceware.org; Sat, 20 Feb 2021 13:16:36 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH v3 108/206] Introduce type_operation Date: Sat, 20 Feb 2021 13:14:31 -0700 Message-Id: <20210220201609.838264-109-tom@tromey.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210220201609.838264-1-tom@tromey.com> References: <20210220201609.838264-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: 97.122.70.152 X-Source-L: No X-Exim-ID: 1lDYg8-000GZH-4A X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-70-152.hlrn.qwest.net (localhost.localdomain) [97.122.70.152]:52692 X-Source-Auth: tom+tromey.com X-Email-Count: 109 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3034.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Sat, 20 Feb 2021 20:16:55 -0000 This adds class type_operation, which implements OP_TYPE. gdb/ChangeLog 2021-02-20 Tom Tromey * expop.h (class type_operation): New. * eval.c (eval_op_type): No longer static. --- gdb/ChangeLog | 5 +++++ gdb/eval.c | 2 +- gdb/expop.h | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gdb/eval.c b/gdb/eval.c index b38cb967a25..d9683912e53 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -2032,7 +2032,7 @@ eval_op_postdec (struct type *expect_type, struct expression *exp, /* A helper function for OP_TYPE. */ -static struct value * +struct value * eval_op_type (struct type *expect_type, struct expression *exp, enum noside noside, struct type *type) { diff --git a/gdb/expop.h b/gdb/expop.h index 4b1d65a1be8..8b7bfbe3af6 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -186,6 +186,9 @@ extern struct value *eval_op_ind (struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1); +extern struct value *eval_op_type (struct type *expect_type, + struct expression *exp, + enum noside noside, struct type *type); namespace expr { @@ -1420,6 +1423,28 @@ class unop_ind_operation } }; +/* Implement OP_TYPE. */ +class type_operation + : public tuple_holding_operation +{ +public: + + using tuple_holding_operation::tuple_holding_operation; + + value *evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) override + { + return eval_op_type (expect_type, exp, noside, std::get<0> (m_storage)); + } + + enum exp_opcode opcode () const override + { return OP_TYPE; } + + bool constant_p () const override + { return true; } +}; + } /* namespace expr */ #endif /* EXPOP_H */ -- 2.26.2