Export build_stub_type and use it in reflect.cc where needed.

This commit is contained in:
Jakub Jelinek
2025-12-29 14:31:26 +01:00
committed by Marek Polacek
parent 59af6f1796
commit 34e0841e21
3 changed files with 17 additions and 23 deletions

View File

@@ -7825,6 +7825,7 @@ extern tree get_copy_ctor (tree, tsubst_flags_t);
extern tree get_copy_assign (tree);
extern tree get_default_ctor (tree);
extern tree get_dtor (tree, tsubst_flags_t);
extern tree build_stub_type (tree, int, bool);
extern tree build_stub_object (tree);
extern bool is_stub_object (tree);
extern tree build_invoke (tree, const_tree,

View File

@@ -1899,7 +1899,7 @@ maybe_synthesize_method (tree fndecl)
/* Build a reference to type TYPE with cv-quals QUALS, which is an
rvalue if RVALUE is true. */
static tree
tree
build_stub_type (tree type, int quals, bool rvalue)
{
tree argtype = cp_build_qualified_type (type, quals);

View File

@@ -492,11 +492,10 @@ get_range_elts (location_t loc, const constexpr_ctx *ctx, tree call, int n,
*non_constant_p = true;
return NULL_TREE;
}
tree cvaluet
= cp_build_qualified_type (valuet, cp_type_quals (valuet)
| TYPE_QUAL_CONST);
TREE_VEC_ELT (args, 0)
= cp_build_reference_type (cvaluet, /*rval=*/false);
= build_stub_type (valuet,
cp_type_quals (valuet) | TYPE_QUAL_CONST,
false);
if (!is_xible (INIT_EXPR, valuet, args))
{
if (!cxx_constexpr_quiet_p (ctx))
@@ -4390,9 +4389,8 @@ static tree
eval_is_copy_constructible_type (tree type)
{
tree arg = make_tree_vec (1);
tree ctype
= cp_build_qualified_type (type, cp_type_quals (type) | TYPE_QUAL_CONST);
TREE_VEC_ELT (arg, 0) = cp_build_reference_type (ctype, /*rval=*/false);
TREE_VEC_ELT (arg, 0)
= build_stub_type (type, cp_type_quals (type) | TYPE_QUAL_CONST, false);
if (is_xible (INIT_EXPR, type, arg))
return boolean_true_node;
else
@@ -4426,9 +4424,8 @@ static tree
eval_is_copy_assignable_type (tree type)
{
tree type1 = cp_build_reference_type (type, /*rval=*/false);
tree type2
= cp_build_qualified_type (type, cp_type_quals (type) | TYPE_QUAL_CONST);
type2 = cp_build_reference_type (type2, /*rval=*/false);
tree type2 = build_stub_type (type, cp_type_quals (type) | TYPE_QUAL_CONST,
false);
if (is_xible (MODIFY_EXPR, type1, type2))
return boolean_true_node;
else
@@ -4484,9 +4481,8 @@ static tree
eval_is_trivially_copy_constructible_type (tree type)
{
tree arg = make_tree_vec (1);
tree ctype
= cp_build_qualified_type (type, cp_type_quals (type) | TYPE_QUAL_CONST);
TREE_VEC_ELT (arg, 0) = cp_build_reference_type (ctype, /*rval=*/false);
TREE_VEC_ELT (arg, 0)
= build_stub_type (type, cp_type_quals (type) | TYPE_QUAL_CONST, false);
if (is_trivially_xible (INIT_EXPR, type, arg))
return boolean_true_node;
else
@@ -4520,9 +4516,8 @@ static tree
eval_is_trivially_copy_assignable_type (tree type)
{
tree type1 = cp_build_reference_type (type, /*rval=*/false);
tree type2
= cp_build_qualified_type (type, cp_type_quals (type) | TYPE_QUAL_CONST);
type2 = cp_build_reference_type (type2, /*rval=*/false);
tree type2 = build_stub_type (type, cp_type_quals (type) | TYPE_QUAL_CONST,
false);
if (is_trivially_xible (MODIFY_EXPR, type1, type2))
return boolean_true_node;
else
@@ -4578,9 +4573,8 @@ static tree
eval_is_nothrow_copy_constructible_type (tree type)
{
tree arg = make_tree_vec (1);
tree ctype
= cp_build_qualified_type (type, cp_type_quals (type) | TYPE_QUAL_CONST);
TREE_VEC_ELT (arg, 0) = cp_build_reference_type (ctype, /*rval=*/false);
TREE_VEC_ELT (arg, 0)
= build_stub_type (type, cp_type_quals (type) | TYPE_QUAL_CONST, false);
if (is_nothrow_xible (INIT_EXPR, type, arg))
return boolean_true_node;
else
@@ -4614,9 +4608,8 @@ static tree
eval_is_nothrow_copy_assignable_type (tree type)
{
tree type1 = cp_build_reference_type (type, /*rval=*/false);
tree type2
= cp_build_qualified_type (type, cp_type_quals (type) | TYPE_QUAL_CONST);
type2 = cp_build_reference_type (type2, /*rval=*/false);
tree type2 = build_stub_type (type, cp_type_quals (type) | TYPE_QUAL_CONST,
false);
if (is_nothrow_xible (MODIFY_EXPR, type1, type2))
return boolean_true_node;
else