From patchwork Wed Apr 5 14:03:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 79714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp361333vqo; Wed, 5 Apr 2023 07:45:07 -0700 (PDT) X-Google-Smtp-Source: AKy350b6YNxV5u2W6O/yUHE+allAdM2FxlA2x+BNnfGd5T0T7kyxV7UhbRdEWKTZy3UasJo4qslT X-Received: by 2002:a17:906:b1d6:b0:923:c55d:efd2 with SMTP id bv22-20020a170906b1d600b00923c55defd2mr2853372ejb.68.1680705907424; Wed, 05 Apr 2023 07:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680705907; cv=none; d=google.com; s=arc-20160816; b=AGvn8Dnlf6QurG4daweUPMRNmvQE3BF3a9s+DKLmsfnUg25IuielRo/Df34zMEo+74 DZ/4ERkqlAkYWR8GLYzXOGJUzXYmUiOYbiAo5ei322dl1I2U97G4skO4bqMYmuZnoHhq s10BHO2EKK98sgfRAermhA1rVXdHkM0rcw2z6PdJkRUBgZDMiSaspQbm7EfiL6EQEfS4 1TR6bgmnlDVFUXavJM7hPV2zt79hUcqecpTLXQlGr23qNF1y25t2EMxDynrGMnEjSBRO j59eyynR9UXv2/jYh5w47t7+SCrzmEOLBUpSgMvwVcb8AdAac7v1NirOh/EheWgPLZ14 3puw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dmarc-filter :delivered-to; bh=z+/TB1DTi/dzWqWqIPxcanvy0VOcpbktvMfQnu3W9PA=; b=kSZ3btLe9whJsngY8oJ+4C0/9Uc9Ge932b7edU3TVqriVo+yOPTVwEXZbuVaZzxxNF a4ftiZGtD1DpY9x7Kt2r+6i2zIYG8NPPo/6Y1SpUn2oGj+MlMlylxb1oj1kn2Eod0gss WC1irvQvu8MhPQreFkh+jmBMqMxdOc8cpP+KupyFsZ5T3a8ehBrKEl7cVKZf+2MWMZ1+ b2o/j8jeWudKTQp3+K6FsUS1FEGk/pseZLeot4OZJk9b2C1so04egYYGSEQpBcsvHibX 1YyLd1SwfGqeQsE9oOEdMJpNTBMbfZm3KCulmtbfkcCXLlKwy/Qtp21tQ82SGT479YH4 zA4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=O7lmjTJ3; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b20-20020aa7cd14000000b005021f2d34e0si1298766edw.351.2023.04.05.07.45.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:45:07 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=O7lmjTJ3; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7197638555BA for ; Wed, 5 Apr 2023 14:16:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 0C89A3882155 for ; Wed, 5 Apr 2023 14:06:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C89A3882155 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x329.google.com with SMTP id l10-20020a05600c1d0a00b003f04bd3691eso7161488wms.5 for ; Wed, 05 Apr 2023 07:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703580; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=z+/TB1DTi/dzWqWqIPxcanvy0VOcpbktvMfQnu3W9PA=; b=O7lmjTJ3mAGRyKey3ltVuxmFyc69zfZYTcdJYR7oETrxTHBrlhh0X58AfOCywV9A7z rRE1NryLOYapWFjU+lNjCzmvEss5sebrZJG1vBmaQ53Bq+zOYwVha5uGJ3M0kFCnPOkd ehEvD2qC5oE1Qt6R9rpsdwrdYfHUvP9heLRk8iBbFpADEDwpc/2F2+hajpvO1mjCTTnA TmeS2QztWK71eZpk5Ql+4RclBxAv6mZZmJdNVPIxSfgqtlTtXclkg37SKzwHdTcQzEZq gvmZwzPdrhwcxvX9JAaPHCKcK4nRf+JhgsLbnCHXUjntidg23E4NsKzI0kFIGVrcrGX1 Q3mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703580; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=z+/TB1DTi/dzWqWqIPxcanvy0VOcpbktvMfQnu3W9PA=; b=wCS14x2pZX+AErQXP8QInyyc2wBJGFhidRXgz37oCiSZhgY+sDrfdrD/dNIxJELQHz gF/fKD99LVodCTzqAj81+IzEC71Tnwwem/o9N5sHvvxV/3w03D8+I7y7v0JFD1XHzIm6 Fuyp2DoX+PwQR3ROn2KrBLtCEo7zs6Bg7lAqDdogKdkWZ3sqf1OvOFjin70iOiOWFiIl HEcl8VmCd3Tt2+e6l9u5teFztKrCc6HRYUVOxLGGS4RVAKC4WeJUSWxJQNIOq2TOuP/S lOEc7JaQLicpbqNuxcYJHt+9Y215IFU0Z/YJ/X1pyZetGz4umwgpvDG7Eyjd0UymsI2x JjaA== X-Gm-Message-State: AAQBX9e9PuiEBC7VhUjCTRqJ1UxGrJTJ73Bfmh1enaTwXIQvNTrCQ17e BzpVm89H+Y9ASdG2x/9QSMswicquCpi6w76LSQ== X-Received: by 2002:a1c:7406:0:b0:3ee:18e:a1ef with SMTP id p6-20020a1c7406000000b003ee018ea1efmr4459883wmc.1.1680703580364; Wed, 05 Apr 2023 07:06:20 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b003edddae1068sm2330150wmb.9.2023.04.05.07.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:06:20 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Philip Herron Subject: [committed 74/88] gccrs: Add new virtual function HIR::ImplItem::get_impl_item_name Date: Wed, 5 Apr 2023 16:03:58 +0200 Message-Id: <20230405140411.3016563-75-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405140411.3016563-1-arthur.cohen@embecosm.com> References: <20230405140411.3016563-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.5 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762347877878296585?= X-GMAIL-MSGID: =?utf-8?q?1762347877878296585?= From: Philip Herron Signed-off-by: Philip Herron gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h: implement virtual function * hir/tree/rust-hir.h: add virtual function --- gcc/rust/hir/tree/rust-hir-item.h | 17 ++++++++++++++++- gcc/rust/hir/tree/rust-hir.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index f7bf1f879c8..03e1f71abb5 100644 --- a/gcc/rust/hir/tree/rust-hir-item.h +++ b/gcc/rust/hir/tree/rust-hir-item.h @@ -1226,6 +1226,11 @@ public: SelfParam &get_self_param () { return self; } + std::string get_impl_item_name () const override final + { + return get_function_name (); + } + protected: /* Use covariance to implement clone function as returning this object * rather than base */ @@ -1345,6 +1350,11 @@ public: return get_mappings (); }; + std::string get_impl_item_name () const override final + { + return get_new_type_name (); + } + protected: /* Use covariance to implement clone function as returning this object * rather than base */ @@ -2116,7 +2126,7 @@ public: Expr *get_expr () { return const_expr.get (); } - std::string get_identifier () { return identifier; } + std::string get_identifier () const { return identifier; } Analysis::NodeMapping get_impl_mappings () const override { @@ -2130,6 +2140,11 @@ public: ItemKind get_item_kind () const override { return ItemKind::Constant; } + std::string get_impl_item_name () const override final + { + return get_identifier (); + } + protected: /* Use covariance to implement clone function as returning this object * rather than base */ diff --git a/gcc/rust/hir/tree/rust-hir.h b/gcc/rust/hir/tree/rust-hir.h index 314aafb32d3..28f1f21a6bb 100644 --- a/gcc/rust/hir/tree/rust-hir.h +++ b/gcc/rust/hir/tree/rust-hir.h @@ -839,6 +839,8 @@ public: virtual ImplItemType get_impl_item_type () const = 0; + virtual std::string get_impl_item_name () const = 0; + protected: // Clone function implementation as pure virtual method virtual ImplItem *clone_inherent_impl_item_impl () const = 0;