From c29d55234e3577021b7dabb623e69732fb1407ce Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Fri, 20 Oct 2023 11:22:11 -0400 Subject: 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. : 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. : 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 --- gcc/cp/cp-objcp-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/cp/cp-objcp-common.h') diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h index 80893aa..1408301 100644 --- a/gcc/cp/cp-objcp-common.h +++ b/gcc/cp/cp-objcp-common.h @@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see /* In cp/objcp-common.c, cp/cp-lang.cc and objcp/objcp-lang.cc. */ extern tree cp_get_debug_type (const_tree); -extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t, tree); +extern tree objcp_tsubst_expr (tree, tree, tsubst_flags_t, tree); extern int cp_decl_dwarf_attribute (const_tree, int); extern int cp_type_dwarf_attribute (const_tree, int); -- cgit v1.1