aboutsummaryrefslogtreecommitdiff
path: root/gcc/objcp
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2023-10-20 11:22:11 -0400
committerPatrick Palka <ppalka@redhat.com>2023-10-20 11:22:11 -0400
commitc29d55234e3577021b7dabb623e69732fb1407ce (patch)
tree4ccc93fcbdeead569904a8163defcd49e4f4bed3 /gcc/objcp
parent3e3d73ed5e85e7f467c366e9ad219d558ef9cb79 (diff)
downloadgcc-c29d55234e3577021b7dabb623e69732fb1407ce.zip
gcc-c29d55234e3577021b7dabb623e69732fb1407ce.tar.gz
gcc-c29d55234e3577021b7dabb623e69732fb1407ce.tar.bz2
c++: rename tsubst_copy_and_build and tsubst_expr
After the previous patch, we now only have two tsubst entry points for expression trees: tsubst_copy_and_build and tsubst_expr. The former despite its unwieldy name is the main entry point, and the latter is just a superset of the former that also handles statement trees. We could merge them so that we just have tsubst_expr, but it seems natural to distinguish statement trees from expression trees and to maintain a separate entry point for them. To that end, this this patch renames tsubst_copy_and_build to tsubst_expr, and renames the current tsubst_expr to tsubst_stmt, which continues to be a superset of the former (which is convenient since sometimes expression trees appear in statement contexts, e.g. a branch of an IF_STMT could be NOP_EXPR). (Making tsubst_stmt disjoint from tsubst_expr is left as future work if deemed desirable.) This patch in turn renames suitable existing uses of tsubst_expr (that expect to take statement trees) to use tsubst_stmt. Thus untouched tsubst_expr calls are implicitly strengthened to expect only expression trees after this patch. For the tsubst_omp_* routines I opted to rename all existing uses to ensure no unintended functional change. This patch also moves the handling of CO_YIELD_EXPR and CO_AWAIT_EXPR from tsubst_stmt to tsubst_expr since they're indeed expression trees. gcc/cp/ChangeLog: * cp-lang.cc (objcp_tsubst_copy_and_build): Rename to ... (objcp_tsubst_expr): ... this. * cp-objcp-common.h (objcp_tsubst_copy_and_build): Rename to ... (objcp_tsubst_expr): ... this. * cp-tree.h (tsubst_copy_and_build): Remove declaration. * init.cc (maybe_instantiate_nsdmi_init): Use tsubst_expr instead of tsubst_copy_and_build. * pt.cc (expand_integer_pack): Likewise. (instantiate_non_dependent_expr_internal): Likewise. (instantiate_class_template): Use tsubst_stmt instead of tsubst_expr for STATIC_ASSERT. (tsubst_function_decl): Adjust tsubst_copy_and_build uses. (tsubst_arg_types): Likewise. (tsubst_exception_specification): Likewise. (tsubst_tree_list): Likewise. (tsubst): Likewise. (tsubst_name): Likewise. (tsubst_omp_clause_decl): Use tsubst_stmt instead of tsubst_expr. (tsubst_omp_clauses): Likewise. (tsubst_copy_asm_operands): Adjust tsubst_copy_and_build use. (tsubst_omp_for_iterator): Use tsubst_stmt instead of tsubst_expr. (tsubst_expr): Rename to ... (tsubst_stmt): ... this. <case CO_YIELD_EXPR, CO_AWAIT_EXPR>: Move to tsubst_expr. (tsubst_omp_udr): Use tsubst_stmt instead of tsubst_expr. (tsubst_non_call_postfix_expression): Adjust tsubst_copy_and_build use. (tsubst_lambda_expr): Likewise. Use tsubst_stmt instead of tsubst_expr for the body of a lambda. (tsubst_copy_and_build_call_args): Rename to ... (tsubst_call_args): ... this. Adjust tsubst_copy_and_build use. (tsubst_copy_and_build): Rename to tsubst_expr. Adjust tsubst_copy_and_build and tsubst_copy_and_build_call_args use. <case TRANSACTION_EXPR>: Use tsubst_stmt instead of tsubst_expr. (maybe_instantiate_noexcept): Adjust tsubst_copy_and_build use. (instantiate_body): Use tsubst_stmt instead of tsubst_expr for substituting the function body. (tsubst_initializer_list): Adjust tsubst_copy_and_build use. gcc/objcp/ChangeLog: * objcp-lang.cc (objcp_tsubst_copy_and_build): Rename to ... (objcp_tsubst_expr): ... this. Adjust tsubst_copy_and_build uses. Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/objcp')
-rw-r--r--gcc/objcp/objcp-lang.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/gcc/objcp/objcp-lang.cc b/gcc/objcp/objcp-lang.cc
index 9887209..5b04cd6 100644
--- a/gcc/objcp/objcp-lang.cc
+++ b/gcc/objcp/objcp-lang.cc
@@ -50,11 +50,10 @@ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
there should be very few (if any) routines below. */
tree
-objcp_tsubst_copy_and_build (tree t, tree args, tsubst_flags_t complain,
- tree in_decl)
+objcp_tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
#define RECURSE(NODE) \
- tsubst_copy_and_build (NODE, args, complain, in_decl)
+ tsubst_expr (NODE, args, complain, in_decl)
/* The following two can only occur in Objective-C++. */