From: Jason Merrill Date: Fri, 8 Jul 2016 21:32:06 +0000 (-0400) Subject: Rename lvalue_or_rvalue_with_address_p to glvalue_p. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c3edc63382ef1856d8ba86fed77342b50007ddd3;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d6f9914b2c1..98fb41a5d9a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-07-08 Jason Merrill + * 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++. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 8b93c61a6db..850956647a6 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.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; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 5b87bb391d9..81f4a05d349 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index fa8db0afded..57da88f6d54 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index fb6a16e00c6..005fc040540 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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 { diff --git a/gcc/cp/typeck.s b/gcc/cp/typeck.s new file mode 100644 index 00000000000..e69de29bb2d