From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 4EBE338362F2; Fri, 9 Dec 2022 11:41:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4EBE338362F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670586065; bh=wTvu6GiEunnYtmu5gZ06sy3FhrNjgtMX+sagCEF91SE=; h=From:To:Subject:Date:From; b=lUw/hEtJrWNf05x8viZkJr3GUrFtsHPw+rDH6pF4RqgbSAlZJlJieGh3BREC1XkUs Grz89sOl2I86IgB222dlIsw+xjtWfizYzCpWwvOYF4LkXix7kDVy4047heFDw/gEJ7 j7QHBe3HVGD4ZV5EiX7WwfxlFsRkNDY29zX5n0+Q= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] const evaluator: Remove get_nth_callarg X-Act-Checkin: gcc X-Git-Author: Arthur Cohen X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: 9666f2b169b5192b5c827d605cc80e6987e1aac5 X-Git-Newrev: 88e509b1b1423867b138617c87a3e709c1db95eb Message-Id: <20221209114105.4EBE338362F2@sourceware.org> Date: Fri, 9 Dec 2022 11:41:05 +0000 (GMT) List-Id: https://gcc.gnu.org/g:88e509b1b1423867b138617c87a3e709c1db95eb commit 88e509b1b1423867b138617c87a3e709c1db95eb Author: Arthur Cohen Date: Thu Nov 17 16:50:58 2022 +0100 const evaluator: Remove get_nth_callarg We only used one path of the C++ folder's get_nth_callarg function: CALL_EXPR_ARG. Replace all calls to get_nth_callarg by macro calls to CALL_EXPR_ARG Diff: --- gcc/rust/backend/rust-constexpr.cc | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/gcc/rust/backend/rust-constexpr.cc b/gcc/rust/backend/rust-constexpr.cc index 21e8bed99b0..438747e9388 100644 --- a/gcc/rust/backend/rust-constexpr.cc +++ b/gcc/rust/backend/rust-constexpr.cc @@ -81,8 +81,6 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, bool potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, tsubst_flags_t flags); -inline tree -get_nth_callarg (tree t, int n); tree unshare_constructor (tree t MEM_STAT_DECL); void @@ -3081,7 +3079,7 @@ rs_bind_parameters_in_call (const constexpr_ctx *ctx, tree t, tree fun, tree type = parms ? TREE_TYPE (parms) : void_type_node; if (parms && DECL_BY_REFERENCE (parms)) type = TREE_TYPE (type); - x = get_nth_callarg (t, i); + x = CALL_EXPR_ARG (t, i); if (TREE_ADDRESSABLE (type)) /* Undo convert_for_arg_passing work here. */ @@ -4081,25 +4079,6 @@ maybe_constexpr_fn (tree t) return (DECL_DECLARED_CONSTEXPR_P (t)); } -// forked from gcc/cp/constexpr.cc get_nth_callarg - -/* We have an expression tree T that represents a call, either CALL_EXPR. - Return the Nth argument. */ - -inline tree -get_nth_callarg (tree t, int n) -{ - switch (TREE_CODE (t)) - { - case CALL_EXPR: - return CALL_EXPR_ARG (t, n); - - default: - gcc_unreachable (); - return NULL; - } -} - // forked from gcc/cp/constexpr.cc var_in_maybe_constexpr_fn /* True if T was declared in a function that might be constexpr: either a @@ -5817,7 +5796,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) && !DECL_CONSTRUCTOR_P (fun)) { - tree x = get_nth_callarg (t, 0); + tree x = CALL_EXPR_ARG (t, 0); /* Don't require an immediately constant value, as constexpr substitution might not use the value. */ @@ -5846,7 +5825,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, } for (; i < nargs; ++i) { - tree x = get_nth_callarg (t, i); + tree x = CALL_EXPR_ARG (t, i); /* In a template, reference arguments haven't been converted to REFERENCE_TYPE and we might not even know if the parameter is a reference, so accept lvalue constants too. */