From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id AB32538582B3 for ; Tue, 30 Jan 2024 12:11:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AB32538582B3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AB32538582B3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::434 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616764; cv=none; b=poC+XyKzLIuAIvGBHimOsI7SibMUmEowCSC+fAYbvhY6iFJKiAIS8bfrNb+MgFcMZsgU7vsr0dq+1TeTmtMF0VKbX6h6hbhIEt7Gfbgy6AApbagT8wU3tHcq9hTUFnVETYYcnlgI9eQgfB4IgVrIEyoW0+nSCLfVud6Mfy+GgKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616764; c=relaxed/simple; bh=irBJwNhO1l3ARJPuyLTROgho9tbJ40AQ8Zi8AFDQ6Jw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=wElLZIdmf6zONDU3X6K3HKDuTjaYCC86D3Rdwiz5khDJEThN6PKlCIG9jqesuEdFcB20f76jEzWa4L0vCRO2nfDtd4uXhcayFOEi2qPHNLWebEU5hg2ihF95h5KT5/CifRQnIOF8jgdxPG0Db05wZ30x3HsrgholsPBLcwAH4OE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-33ae3cc8a6aso2153404f8f.2 for ; Tue, 30 Jan 2024 04:11:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1706616713; x=1707221513; darn=gcc.gnu.org; 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=+V0ES9rIlpfph/NGd5qjXXQp2pTd9XhCqRBek8WS8jk=; b=cOKDsyj3ZN8hXZs/j/IPd8VcZYS8fhBFJS79TGuhvLhppSWRzh/ms1Dca0OzuMCq0E XUseS5A9Rnec0hSQ00TQXZX2c5vMp9CB+8vxnD2CwoVYQL11wryvgT02lsBh1ysYFDkg FvDmEos/U/pO6pJBOLCx3SXVOAIPxdMjC06vtNLRdfs9pr1cbrTu4eQMludr7LikMRBh OdzJKFpofwpkecDcqBY/UFTH8Q+gjOOgGA/gmIWuL41NZbF2wpwPYRUbCi6yqWtqvNk5 VKn1zw5xlcGof33SDf3AmrdMF6MyUfCcgXZDw2BCUXV2lUl9v+E6QxcsNA7ub3cpJkPV ISgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706616713; x=1707221513; 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=+V0ES9rIlpfph/NGd5qjXXQp2pTd9XhCqRBek8WS8jk=; b=WHUlY8a9oDn2nMOuAUY2WbWy9VMVQLvJCfY7mFcIjF1tgM9fSKH+XNnZHaqG31I23T 78fERpPK16n+uBNnGHjFKPTm3VW3Kw/knAnelG1rSkN5Ee0cOWa9mX6oQLhYH9wbfoG2 sOnjZfi10L8qVcmDCGJtEWnjaqc1mItWxLhVOyTRaCt77u+8bRiYTbCLhX4pD3lU5WX4 2QxCZFBONoXvVCpavmmE68qo/QW7fHuP/I67caxp/l0FiTBDM4l9oghMM5CfoZvW0z6y IBi6z5ryUv4zXuif3T8oAf/FeNySyte11bCE3lCuvOtbRCd+hKonk/hov9KZPr+wmIWC l6BA== X-Gm-Message-State: AOJu0Yy2I9zq62AZCmUZxaayJGlYFVaT3aDhOS6qg3c9kBQTDT0d4gUS kBRtUZ7C/Hk40a0sbCetkzag7hVYlWCCsZFSjiA+0sgjUBVYvvjAygzKzmRjMw== X-Google-Smtp-Source: AGHT+IHYssxNgPH5xqlaty5iajl/rdVUq2pbaUKg2ivaLtAiwEPvw02uVJZJqi7OGACBQ0kQ1Gw7Tw== X-Received: by 2002:a5d:510f:0:b0:33a:e7de:aa8b with SMTP id s15-20020a5d510f000000b0033ae7deaa8bmr4448042wrt.26.1706616712489; Tue, 30 Jan 2024 04:11:52 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id f9-20020a056000036900b00339307d9d31sm10569894wrf.112.2024.01.30.04.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:11:52 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Jakub Dupak Subject: [COMMITTED 087/101] gccrs: TyTy: Refactor FnType deprecated API Date: Tue, 30 Jan 2024 13:07:43 +0100 Message-ID: <20240130121026.807464-90-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20240130121026.807464-2-arthur.cohen@embecosm.com> References: <20240130121026.807464-2-arthur.cohen@embecosm.com> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.2 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Jakub Dupak gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Use new API. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use new API. * typecheck/rust-tyty-cmp.h: Remove old API. * typecheck/rust-tyty.cc (FnPtr::is_equal): Use new API. * typecheck/rust-tyty.h: Remove old API. * typecheck/rust-unify.cc (UnifyRules::expect_fnptr): Use new API. Signed-off-by: Jakub Dupak --- gcc/rust/backend/rust-compile-expr.cc | 2 +- gcc/rust/typecheck/rust-tyty-call.cc | 2 +- gcc/rust/typecheck/rust-tyty-cmp.h | 6 +++--- gcc/rust/typecheck/rust-tyty.cc | 2 +- gcc/rust/typecheck/rust-tyty.h | 3 --- gcc/rust/typecheck/rust-unify.cc | 6 +++--- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index e0917f68660..596b848849e 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -1198,7 +1198,7 @@ CompileExpr::visit (HIR::CallExpr &expr) if (base->get_kind () == TyTy::TypeKind::FNPTR) { const TyTy::FnPtr *fn = static_cast (base); - *result = fn->param_at (index); + *result = fn->get_param_type_at (index); return true; } diff --git a/gcc/rust/typecheck/rust-tyty-call.cc b/gcc/rust/typecheck/rust-tyty-call.cc index 31afe046a13..a28780bcac3 100644 --- a/gcc/rust/typecheck/rust-tyty-call.cc +++ b/gcc/rust/typecheck/rust-tyty-call.cc @@ -271,7 +271,7 @@ TypeCheckCallExpr::visit (FnPtr &type) for (auto &argument : call.get_arguments ()) { location_t arg_locus = argument->get_locus (); - BaseType *fnparam = type.param_at (i); + BaseType *fnparam = type.get_param_type_at (i); auto argument_expr_tyty = Resolver::TypeCheckExpr::Resolve (argument.get ()); if (argument_expr_tyty->get_kind () == TyTy::TypeKind::ERROR) diff --git a/gcc/rust/typecheck/rust-tyty-cmp.h b/gcc/rust/typecheck/rust-tyty-cmp.h index 6d4bc16bf6e..98ff1dc664e 100644 --- a/gcc/rust/typecheck/rust-tyty-cmp.h +++ b/gcc/rust/typecheck/rust-tyty-cmp.h @@ -800,8 +800,8 @@ public: for (size_t i = 0; i < base->num_params (); i++) { - auto this_param = base->param_at (i); - auto other_param = type.param_at (i); + auto this_param = base->get_param_type_at (i); + auto other_param = type.get_param_type_at (i); if (!this_param->can_eq (other_param, emit_error_flag)) { BaseCmp::visit (type); @@ -830,7 +830,7 @@ public: for (size_t i = 0; i < base->num_params (); i++) { - auto this_param = base->param_at (i); + auto this_param = base->get_param_type_at (i); auto other_param = type.param_at (i).second; if (!this_param->can_eq (other_param, emit_error_flag)) { diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index e9b42ebebee..f1789f008a0 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -2123,7 +2123,7 @@ FnPtr::is_equal (const BaseType &other) const for (size_t i = 0; i < num_params (); i++) { - if (!param_at (i)->is_equal (*other2.param_at (i))) + if (!get_param_type_at (i)->is_equal (*other2.get_param_type_at (i))) return false; } return true; diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 2ed407ee169..b04048f400d 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -926,9 +926,6 @@ public: size_t num_params () const { return params.size (); } - // DEPRECATED: Use get_param_type_at - BaseType *param_at (size_t idx) const { return get_param_type_at (idx); } - void accept_vis (TyVisitor &vis) override; void accept_vis (TyConstVisitor &vis) const override; diff --git a/gcc/rust/typecheck/rust-unify.cc b/gcc/rust/typecheck/rust-unify.cc index 3027f099739..8b43380cc59 100644 --- a/gcc/rust/typecheck/rust-unify.cc +++ b/gcc/rust/typecheck/rust-unify.cc @@ -1009,8 +1009,8 @@ UnifyRules::expect_fnptr (TyTy::FnPtr *ltype, TyTy::BaseType *rtype) for (size_t i = 0; i < ltype->num_params (); i++) { - auto a = ltype->param_at (i); - auto b = type.param_at (i); + auto a = ltype->get_param_type_at (i); + auto b = type.get_param_type_at (i); auto unified_param = UnifyRules::Resolve (TyTy::TyWithLocation (a), @@ -1058,7 +1058,7 @@ UnifyRules::expect_fnptr (TyTy::FnPtr *ltype, TyTy::BaseType *rtype) for (size_t i = 0; i < ltype->num_params (); i++) { - auto this_param = ltype->param_at (i); + auto this_param = ltype->get_param_type_at (i); auto other_param = type.param_at (i).second; auto unified_param -- 2.42.1