Commit c3edc633 by Jason Merrill Committed by Jason Merrill

Rename lvalue_or_rvalue_with_address_p to glvalue_p.

	* tree.c (glvalue_p): Rename from lvalue_or_rvalue_with_address_p.
	* call.c, cp-tree.h, typeck.c: Adjust.

From-SVN: r238181
parent 0596c448
2016-07-08 Jason Merrill <jason@redhat.com>
* tree.c (glvalue_p): Rename from lvalue_or_rvalue_with_address_p.
* call.c, cp-tree.h, typeck.c: Adjust.
* lambda.c (maybe_add_lambda_conv_op): Fix null object argument.
P0145R2: Refining Expression Order for C++.
......
......@@ -4549,7 +4549,7 @@ conditional_conversion (tree e1, tree e2, tsubst_flags_t complain)
If E2 is an xvalue: E1 can be converted to match E2 if E1 can be
implicitly converted to the type "rvalue reference to T2", subject to
the constraint that the reference must bind directly. */
if (lvalue_or_rvalue_with_address_p (e2))
if (glvalue_p (e2))
{
tree rtype = cp_build_reference_type (t2, !real_lvalue_p (e2));
conv = implicit_conversion (rtype,
......@@ -4882,8 +4882,7 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
&& (CLASS_TYPE_P (arg2_type) || CLASS_TYPE_P (arg3_type)
|| (same_type_ignoring_top_level_qualifiers_p (arg2_type,
arg3_type)
&& lvalue_or_rvalue_with_address_p (arg2)
&& lvalue_or_rvalue_with_address_p (arg3)
&& glvalue_p (arg2) && glvalue_p (arg3)
&& real_lvalue_p (arg2) == real_lvalue_p (arg3))))
{
conversion *conv2;
......
......@@ -6515,7 +6515,7 @@ extern tree copy_binfo (tree, tree, tree,
extern int member_p (const_tree);
extern cp_lvalue_kind real_lvalue_p (const_tree);
extern cp_lvalue_kind lvalue_kind (const_tree);
extern bool lvalue_or_rvalue_with_address_p (const_tree);
extern bool glvalue_p (const_tree);
extern bool xvalue_p (const_tree);
extern tree cp_stabilize_reference (tree);
extern bool builtin_valid_in_constant_expr_p (const_tree);
......
......@@ -266,20 +266,10 @@ real_lvalue_p (const_tree ref)
return kind;
}
/* This differs from real_lvalue_p in that class rvalues are considered
lvalues. */
/* This differs from real_lvalue_p in that xvalues are included. */
bool
lvalue_p (const_tree ref)
{
return (lvalue_kind (ref) != clk_none);
}
/* This differs from real_lvalue_p in that rvalues formed by dereferencing
rvalue references are considered rvalues. */
bool
lvalue_or_rvalue_with_address_p (const_tree ref)
glvalue_p (const_tree ref)
{
cp_lvalue_kind kind = lvalue_kind (ref);
if (kind & clk_class)
......@@ -288,7 +278,16 @@ lvalue_or_rvalue_with_address_p (const_tree ref)
return (kind != clk_none);
}
/* Returns true if REF is an xvalue, false otherwise. */
/* This differs from glvalue_p in that class prvalues are included. */
bool
lvalue_p (const_tree ref)
{
return (lvalue_kind (ref) != clk_none);
}
/* Returns true if REF is an xvalue (the result of dereferencing an rvalue
reference), false otherwise. */
bool
xvalue_p (const_tree ref)
......@@ -781,7 +780,7 @@ rvalue (tree expr)
/* We need to do this for rvalue refs as well to get the right answer
from decltype; see c++/36628. */
if (!processing_template_decl && lvalue_or_rvalue_with_address_p (expr))
if (!processing_template_decl && glvalue_p (expr))
expr = build1 (NON_LVALUE_EXPR, type, expr);
else if (type != TREE_TYPE (expr))
expr = build_nop (type, expr);
......@@ -4260,7 +4259,7 @@ stabilize_expr (tree exp, tree* initp)
arguments with such a type; just treat it as a pointer. */
else if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE
|| SCALAR_TYPE_P (TREE_TYPE (exp))
|| !lvalue_or_rvalue_with_address_p (exp))
|| !glvalue_p (exp))
{
init_expr = get_target_expr (exp);
exp = TARGET_EXPR_SLOT (init_expr);
......@@ -4388,7 +4387,7 @@ stabilize_init (tree init, tree *initp)
&& TREE_CODE (t) != CONSTRUCTOR
&& TREE_CODE (t) != AGGR_INIT_EXPR
&& (SCALAR_TYPE_P (TREE_TYPE (t))
|| lvalue_or_rvalue_with_address_p (t)))
|| glvalue_p (t)))
{
TREE_OPERAND (init, 1) = stabilize_expr (t, initp);
return true;
......
......@@ -6302,8 +6302,7 @@ build_x_conditional_expr (location_t loc, tree ifexp, tree op1, tree op2,
tree min = build_min_non_dep (COND_EXPR, expr,
orig_ifexp, orig_op1, orig_op2);
/* Remember that the result is an lvalue or xvalue. */
if (lvalue_or_rvalue_with_address_p (expr)
&& !lvalue_or_rvalue_with_address_p (min))
if (glvalue_p (expr) && !glvalue_p (min))
TREE_TYPE (min) = cp_build_reference_type (TREE_TYPE (min),
!real_lvalue_p (expr));
expr = convert_from_reference (min);
......@@ -7243,7 +7242,7 @@ build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain,
? real_lvalue_p (expr)
: (CLASS_TYPE_P (TREE_TYPE (dst_type))
? lvalue_p (expr)
: lvalue_or_rvalue_with_address_p (expr)))
: glvalue_p (expr)))
/* OK. */;
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment