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: 1765477 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=O7lmjTJ3; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Ps6G12Lrwz1yZh for ; Thu, 6 Apr 2023 00:19:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9ABC33AA8011 for ; Wed, 5 Apr 2023 14:15:45 +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-Google-Smtp-Source: AKy350bzPP9QVsGzi43J5Moxpv3ktNE2v1WJQXRtK3YQMfCBbNl2NhY0FF4CbXSnh1W59tJgZcE99Q== 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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;