From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id BE3A6385357B for ; Wed, 5 Apr 2023 14:05:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BE3A6385357B 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-x32a.google.com with SMTP id n19so20971628wms.0 for ; Wed, 05 Apr 2023 07:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703553; 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=TMb6dOaZEARu81vby2cyTeo9PCXn8l9sBPaHTXh8D84=; b=M8882M9sNlp42X+pIAGNh0FK6jEwoHDEfTbepEAJ6sCA0ug1ZJzelv5xYSadjjjrNE l1kJ2S/ggFhJFHMenf5zSlbmMEkUVLXq+p0WKPL6SaEN7/uz9AIqmC759/bqsJ/uC10w JJ/YPAhmEBN13VfTnum9cX9Eb9+rVHpu4MsPpMux/pAXkkaumMiKwI8ww5HFZRDht2p0 9SnXZhu9rE/1VD0zu9Y1qqzMLearMnnBDx+eKSRy8KZXWU8ksS4+jNM61PummnH8X2v3 X2x6H3J3Aeu1eq67YDL90fg8IlFADeY4VhaJ+euFpiGapWDdBrKEbODX13eyQA353R1F ebbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703553; 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=TMb6dOaZEARu81vby2cyTeo9PCXn8l9sBPaHTXh8D84=; b=NvKunAuxG/f1xLSeZa45D47EIOqnDznp2L3z/4tqw/C9B8dt3BHTVD8wc2H9kgO9r2 Vth34rVftMN58Km12341KViYacR4Wx9DtjMZLqnGU/UmioChzQ8IU2DjoVKsRiph5ztI mEQg0Tnsv3YYiv9R5zzEyM3xRUoLkK7ArV3MSAxhqdkq1xMZKwRDDmSxrcNJbGC5OdDV GZsRrdbjJSYJWOZLSWbBZH8ZdwXkA0ymvrZWO/uExhkxYTMQBpn+O6T/+DI8Lhbb/Bh2 W+xx75vr2IQtNG9T9JfQrom0OxXOfqt2jSkNE1y19GZWBweUqMLa8oo3wImkU3hjujRV lsrQ== X-Gm-Message-State: AAQBX9dWr8nQaUVakgtPrFolZd6vc84n2ToJULkwBOwZCndq4W0n9gmQ xorSVQDWrUGCPbwnytR4xz7/ X-Google-Smtp-Source: AKy350aQtBEWr4KrXb4EDOf+JAcH/Q5QGiVrabr5opM5QzKYiQPvPx0WHcg/cPc75wC0NtcPjxYk+Q== X-Received: by 2002:a1c:f216:0:b0:3ee:4ff0:83d6 with SMTP id s22-20020a1cf216000000b003ee4ff083d6mr4907618wmc.40.1680703553313; Wed, 05 Apr 2023 07:05:53 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b003edddae1068sm2330150wmb.9.2023.04.05.07.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:05:53 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Philip Herron Subject: [committed 36/88] gccrs: Move TypePredicateItem impl out of the header Date: Wed, 5 Apr 2023 16:03:20 +0200 Message-Id: <20230405140411.3016563-37-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> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.6 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 List-Id: From: Philip Herron This moves the implementation code out of the header and into its respective cc file. Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-bounds.cc (TypeBoundPredicateItem::error): refactor (TypeBoundPredicateItem::is_error): likewise (TypeBoundPredicateItem::get_parent): likewise * typecheck/rust-tyty.h: Move the implementation for the above --- gcc/rust/typecheck/rust-tyty-bounds.cc | 24 ++++++++++++++++++++++++ gcc/rust/typecheck/rust-tyty.h | 16 ++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/gcc/rust/typecheck/rust-tyty-bounds.cc b/gcc/rust/typecheck/rust-tyty-bounds.cc index 30f7b0d02e3..e7eb9a760f5 100644 --- a/gcc/rust/typecheck/rust-tyty-bounds.cc +++ b/gcc/rust/typecheck/rust-tyty-bounds.cc @@ -364,6 +364,30 @@ TypeBoundPredicate::lookup_associated_item (const std::string &search) const return TypeBoundPredicateItem (this, trait_item_ref); } +TypeBoundPredicateItem::TypeBoundPredicateItem ( + const TypeBoundPredicate *parent, + const Resolver::TraitItemReference *trait_item_ref) + : parent (parent), trait_item_ref (trait_item_ref) +{} + +TypeBoundPredicateItem +TypeBoundPredicateItem::error () +{ + return TypeBoundPredicateItem (nullptr, nullptr); +} + +bool +TypeBoundPredicateItem::is_error () const +{ + return parent == nullptr || trait_item_ref == nullptr; +} + +const TypeBoundPredicate * +TypeBoundPredicateItem::get_parent () const +{ + return parent; +} + TypeBoundPredicateItem TypeBoundPredicate::lookup_associated_item ( const Resolver::TraitItemReference *ref) const diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 20a243fe980..7d32ed59494 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -82,19 +82,11 @@ class TypeBoundPredicateItem { public: TypeBoundPredicateItem (const TypeBoundPredicate *parent, - const Resolver::TraitItemReference *trait_item_ref) - : parent (parent), trait_item_ref (trait_item_ref) - {} + const Resolver::TraitItemReference *trait_item_ref); - static TypeBoundPredicateItem error () - { - return TypeBoundPredicateItem (nullptr, nullptr); - } + static TypeBoundPredicateItem error (); - bool is_error () const - { - return parent == nullptr || trait_item_ref == nullptr; - } + bool is_error () const; BaseType *get_tyty_for_receiver (const TyTy::BaseType *receiver); @@ -102,7 +94,7 @@ public: bool needs_implementation () const; - const TypeBoundPredicate *get_parent () const { return parent; } + const TypeBoundPredicate *get_parent () const; Location get_locus () const; -- 2.40.0