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>
Showing
- gcc/cp/cp-lang.cc 2 additions, 4 deletionsgcc/cp/cp-lang.cc
- gcc/cp/cp-objcp-common.h 1 addition, 1 deletiongcc/cp/cp-objcp-common.h
- gcc/cp/cp-tree.h 0 additions, 1 deletiongcc/cp/cp-tree.h
- gcc/cp/init.cc 1 addition, 2 deletionsgcc/cp/init.cc
- gcc/cp/pt.cc 79 additions, 98 deletionsgcc/cp/pt.cc
- gcc/objcp/objcp-lang.cc 2 additions, 3 deletionsgcc/objcp/objcp-lang.cc
Loading
Please register or sign in to comment