aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constexpr.cc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2022-09-12 17:55:53 -0400
committerPatrick Palka <ppalka@redhat.com>2022-09-12 17:55:53 -0400
commitc17fa0f20eb29bd1cab5e438c72b96281693ac29 (patch)
tree24f21093bcdd544216dd99f5ba76ee06043d15b8 /gcc/cp/constexpr.cc
parentc3ba0eaaa223f7b8208d279e3f39ff134912f9e9 (diff)
downloadgcc-c17fa0f20eb29bd1cab5e438c72b96281693ac29.zip
gcc-c17fa0f20eb29bd1cab5e438c72b96281693ac29.tar.gz
gcc-c17fa0f20eb29bd1cab5e438c72b96281693ac29.tar.bz2
c++: remove '_sfinae' suffix from functions
The functions abstract_virtuals_error cxx_constant_value get_target_expr instantiate_non_dependent_expr require_complete_type are each just a non-SFINAE-enabled wrapper for the corresponding SFINAE-enabled version that's suffixed by '_sfinae'. But this suffix is at best redundant since a 'complain' parameter already broadly conveys that a function is SFINAE-enabled, and having two such versions of a function is less concise than just using a default argument for 'complain' (and arguably no less mistake prone). So this patch squashes the two versions of each of the above functions by adding a default 'complain' argument to the SFINAE-enabled version whose '_sfinae' suffix we then remove. gcc/cp/ChangeLog: * call.cc (build_conditional_expr): Adjust calls to '_sfinae'-suffixed functions. (build_temp): Likewise. (convert_like_internal): Likewise. (convert_arg_to_ellipsis): Likewise. (build_over_call): Likewise. (build_cxx_call): Likewise. (build_new_method_call): Likewise. * constexpr.cc (cxx_eval_outermost_constant_expr): Likewise. (cxx_constant_value_sfinae): Rename to ... (cxx_constant_value): ... this. Document its default arguments. (fold_non_dependent_expr): Adjust function comment. * cp-tree.h (instantiate_non_dependent_expr_sfinae): Rename to ... (instantiate_non_dependent_expr): ... this. Give its 'complain' parameter a default argument. (get_target_expr_sfinae, get_target_expr): Likewise. (require_complete_type_sfinae, require_complete_type): Likewise. (abstract_virtuals_error_sfinae, abstract_virtuals_error): Likewise. (cxx_constant_value_sfinae, cxx_constant_value): Likewise. * cvt.cc (build_up_reference): Adjust calls to '_sfinae'-suffixed functions. (ocp_convert): Likewise. * decl.cc (build_explicit_specifier): Likewise. * except.cc (build_noexcept_spec): Likewise. * init.cc (build_new_1): Likewise. * pt.cc (expand_integer_pack): Likewise. (instantiate_non_dependent_expr_internal): Adjust function comment. (instantiate_non_dependent_expr): Rename to ... (instantiate_non_dependent_expr_sfinae): ... this. Document its default argument. (tsubst_init): Adjust calls to '_sfinae'-suffixed functions. (fold_targs_r): Likewise. * semantics.cc (finish_compound_literal): Likewise. (finish_decltype_type): Likewise. (cp_build_bit_cast): Likewise. * tree.cc (build_cplus_new): Likewise. (get_target_expr): Rename to ... (get_target_expr_sfinae): ... this. Document its default argument. * typeck.cc (require_complete_type): Rename to ... (require_complete_type_sfinae): ... this. Document its default argument. (cp_build_array_ref): Adjust calls to '_sfinae'-suffixed functions. (convert_arguments): Likewise. (cp_build_binary_op): Likewise. (build_static_cast_1): Likewise. (cp_build_modify_expr): Likewise. (convert_for_initialization): Likewise. * typeck2.cc (abstract_virtuals_error): Rename to ... (abstract_virtuals_error_sfinae): ... this. Document its default argument. (build_functional_cast_1): Adjust calls to '_sfinae'-suffixed functions.
Diffstat (limited to 'gcc/cp/constexpr.cc')
-rw-r--r--gcc/cp/constexpr.cc20
1 files changed, 6 insertions, 14 deletions
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index c047fe4..57283ea 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -8068,7 +8068,7 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
r = get_target_expr (r);
else
{
- r = get_target_expr_sfinae (r, tf_warning_or_error | tf_no_cleanup);
+ r = get_target_expr (r, tf_warning_or_error | tf_no_cleanup);
TREE_CONSTANT (r) = true;
}
}
@@ -8081,19 +8081,11 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
}
/* If T represents a constant expression returns its reduced value.
- Otherwise return error_mark_node. If T is dependent, then
- return NULL. */
+ Otherwise return error_mark_node. */
tree
-cxx_constant_value (tree t, tree decl)
-{
- return cxx_eval_outermost_constant_expr (t, false, true, true, false, decl);
-}
-
-/* As above, but respect SFINAE. */
-
-tree
-cxx_constant_value_sfinae (tree t, tree decl, tsubst_flags_t complain)
+cxx_constant_value (tree t, tree decl /* = NULL_TREE */,
+ tsubst_flags_t complain /* = tf_error */)
{
bool sfinae = !(complain & tf_error);
tree r = cxx_eval_outermost_constant_expr (t, sfinae, true, true, false, decl);
@@ -8316,8 +8308,8 @@ fold_non_dependent_expr_template (tree t, tsubst_flags_t complain,
/* Like maybe_constant_value but first fully instantiate the argument.
- Note: this is equivalent to instantiate_non_dependent_expr_sfinae
- (t, complain) followed by maybe_constant_value but is more efficient,
+ Note: this is equivalent to instantiate_non_dependent_expr (t, complain)
+ followed by maybe_constant_value but is more efficient,
because it calls instantiation_dependent_expression_p and
potential_constant_expression at most once.
The manifestly_const_eval argument is passed to maybe_constant_value.