diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-10-20 11:22:11 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-10-20 11:22:11 -0400 |
commit | c29d55234e3577021b7dabb623e69732fb1407ce (patch) | |
tree | 4ccc93fcbdeead569904a8163defcd49e4f4bed3 /gcc/cp/cp-tree.h | |
parent | 3e3d73ed5e85e7f467c366e9ad219d558ef9cb79 (diff) | |
download | gcc-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/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index d6abd15..30fe716 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7461,7 +7461,6 @@ extern void instantiate_pending_templates (int); extern tree tsubst_default_argument (tree, int, tree, tree, tsubst_flags_t); extern tree tsubst (tree, tree, tsubst_flags_t, tree); -extern tree tsubst_copy_and_build (tree, tree, tsubst_flags_t, tree); extern tree tsubst_expr (tree, tree, tsubst_flags_t, tree); extern tree tsubst_pack_expansion (tree, tree, tsubst_flags_t, tree); extern tree tsubst_argument_pack (tree, tree, tsubst_flags_t, tree); |