aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-07-08 17:32:06 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-07-08 17:32:06 -0400
commitc3edc63382ef1856d8ba86fed77342b50007ddd3 (patch)
treef5c511a74bf9eb4fb56d339132634e6eae6b387a /gcc/cp
parent0596c4485c684abe3ad34d81c8cbc79d2787c42b (diff)
downloadgcc-c3edc63382ef1856d8ba86fed77342b50007ddd3.zip
gcc-c3edc63382ef1856d8ba86fed77342b50007ddd3.tar.gz
gcc-c3edc63382ef1856d8ba86fed77342b50007ddd3.tar.bz2
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/call.c5
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/tree.c31
-rw-r--r--gcc/cp/typeck.c5
-rw-r--r--gcc/cp/typeck.s0
6 files changed, 23 insertions, 23 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d6f9914..98fb41a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
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++.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 8b93c61..8509566 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 5b87bb3..81f4a05 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 fa8db0a..57da88f 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 fb6a16e..005fc04 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 0000000..e69de29
--- /dev/null
+++ b/gcc/cp/typeck.s