public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6255] gccrs: const evaluator: Remove get_nth_callarg
@ 2023-02-21 12:03 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2023-02-21 12:03 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:064bbd0fe10437ab0b2b5a386c77c9e285dda760

commit r13-6255-g064bbd0fe10437ab0b2b5a386c77c9e285dda760
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Thu Nov 17 16:50:58 2022 +0100

    gccrs: 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
    
    gcc/rust/ChangeLog:
    
            * backend/rust-constexpr.cc (get_nth_callarg): Remove function.
            (rs_bind_parameters_in_call): Use CALL_EXPR_ARG instead.
            (potential_constant_expression_1): Likewise.

Diff:
---
 gcc/rust/backend/rust-constexpr.cc | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/gcc/rust/backend/rust-constexpr.cc b/gcc/rust/backend/rust-constexpr.cc
index 912d73b5d7c..4e581a3f2cf 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.  */
@@ -4080,17 +4078,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)
-{
-  return CALL_EXPR_ARG (t, n);
-}
-
 // 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
@@ -5808,7 +5795,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.  */
@@ -5837,7 +5824,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.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-21 12:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21 12:03 [gcc r13-6255] gccrs: const evaluator: Remove get_nth_callarg Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).