diff mbox

C++ PATCHes to correct value category predicate names

Message ID CADzB+2ks1fyKnTdmnah1edtjN8bMdTOgi9xYZHNqOZsj69CUEg@mail.gmail.com
State New
Headers show

Commit Message

Jason Merrill July 8, 2016, 9:30 p.m. UTC
For a while I've been meaning to rename
lvalue_or_rvalue_with_address_p to glvalue_p; we've had that term for
a long time.

Then while I was at it, I decided to fix the name "lvalue_p", which
for a long time has really meant "glvalue or class prvalue".  I've
invented the name "obvalue" for this category and renamed the old
lvalue_p to obvalue_p; lvalue_p now actually matches the C++ notion of
lvalue.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit c0d75bbf3a19e80d8c3eb553b91cf5ad822983dc
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jul 7 16:05:29 2016 -0400

    	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.
diff mbox

Patch

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

commit f4477417b14ee075b7ce37db49b3d92f87a5fcc5
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jul 7 16:45:40 2016 -0400

    	Rename lvalue_p to obvalue_p.
    
    	* tree.c (obvalue_p): Rename from lvalue_p.
    	(lvalue_p): Define for c-common.
    	* call.c, cp-tree.h, cvt.c, init.c: Adjust.
    	* typeck.c: Adjust.
    	(cp_build_addr_expr_1): Remove obsolete code.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 8509566..c90b8af 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1126,7 +1126,10 @@  standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
       fcode = TREE_CODE (from);
       conv = build_conv (ck_lvalue, from, conv);
     }
-  else if (fromref || (expr && lvalue_p (expr)))
+  /* Wrapping a ck_rvalue around a class prvalue (as a result of using
+     obvalue_p) seems odd, since it's already a prvalue, but that's how we
+     express the copy constructor call required by copy-initialization.  */
+  else if (fromref || (expr && obvalue_p (expr)))
     {
       if (expr)
 	{
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 81f4a05..a3e53a9 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6516,6 +6516,11 @@  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 glvalue_p				(const_tree);
+/* obvalue_p used to be named lvalue_p, but that didn't match the C++
+   definition of lvalue.  For now, let's not use the name lvalue_p in the front
+   end; later we can rename real_lvalue_p to lvalue_p.  */
+#define lvalue_p(T) syntax error, use real_lvalue_p
+extern bool obvalue_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/cvt.c b/gcc/cp/cvt.c
index 2e2bac7..9dd383e 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -330,7 +330,7 @@  build_up_reference (tree type, tree arg, int flags, tree decl,
       cp_finish_decl (arg, targ, /*init_const_expr_p=*/false, NULL_TREE,
 		      LOOKUP_ONLYCONVERTING|DIRECT_BIND);
     }
-  else if (!(flags & DIRECT_BIND) && ! lvalue_p (arg))
+  else if (!(flags & DIRECT_BIND) && ! obvalue_p (arg))
     return get_target_expr_sfinae (arg, complain);
 
   /* If we had a way to wrap this up, and say, if we ever needed its
@@ -473,7 +473,7 @@  convert_to_reference (tree reftype, tree expr, int convtype,
 
       return build_up_reference (reftype, expr, flags, decl, complain);
     }
-  else if ((convtype & CONV_REINTERPRET) && lvalue_p (expr))
+  else if ((convtype & CONV_REINTERPRET) && obvalue_p (expr))
     {
       /* When casting an lvalue to a reference type, just convert into
 	 a pointer to the new type and deference it.  This is allowed
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index a71c21a..69ff61d 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3332,7 +3332,7 @@  build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
     rval = build2 (COMPOUND_EXPR, TREE_TYPE (rval), init_preeval_expr, rval);
 
   /* A new-expression is never an lvalue.  */
-  gcc_assert (!lvalue_p (rval));
+  gcc_assert (!obvalue_p (rval));
 
   return convert (pointer_type, rval);
 }
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 57da88f..9fda74d 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -266,6 +266,14 @@  real_lvalue_p (const_tree ref)
     return kind;
 }
 
+/* Defined for c-common; the front end should use real_lvalue_p.  */
+
+bool
+(lvalue_p) (const_tree t)
+{
+  return real_lvalue_p (t);
+}
+
 /* This differs from real_lvalue_p in that xvalues are included.  */
 
 bool
@@ -281,7 +289,7 @@  glvalue_p (const_tree ref)
 /* This differs from glvalue_p in that class prvalues are included.  */
 
 bool
-lvalue_p (const_tree ref)
+obvalue_p (const_tree ref)
 {
   return (lvalue_kind (ref) != clk_none);
 }
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 005fc04..a0e6c51 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1987,7 +1987,7 @@  decay_conversion (tree exp,
 			 TREE_OPERAND (exp, 0), op1);
 	}
 
-      if (!lvalue_p (exp)
+      if (!obvalue_p (exp)
 	  && ! (TREE_CODE (exp) == CONSTRUCTOR && TREE_STATIC (exp)))
 	{
 	  if (complain & tf_error)
@@ -5678,16 +5678,8 @@  cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
     CASE_CONVERT:
     case FLOAT_EXPR:
     case FIX_TRUNC_EXPR:
-      /* Even if we're not being pedantic, we cannot allow this
-	 extension when we're instantiating in a SFINAE
-	 context.  */
-      if (! lvalue_p (arg) && complain == tf_none)
-	{
-	  if (complain & tf_error)
-	    permerror (input_location, "ISO C++ forbids taking the address of a cast to a non-lvalue expression");
-	  else
-	    return error_mark_node;
-	}
+      /* We should have handled this above in the lvalue_kind check.  */
+      gcc_unreachable ();
       break;
 
     case BASELINK:
@@ -7240,9 +7232,7 @@  build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain,
       reference_type = dst_type;
       if (!TYPE_REF_IS_RVALUE (dst_type)
 	  ? real_lvalue_p (expr)
-	  : (CLASS_TYPE_P (TREE_TYPE (dst_type))
-	     ? lvalue_p (expr)
-	     : glvalue_p (expr)))
+	  : obvalue_p (expr))
 	/* OK.  */;
       else
 	{

commit 9fd7f623f5ad6685071f1720b4ced3b45538291b
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jul 8 15:53:34 2016 -0400

    	Use lvalue_p instead of real_lvalue_p.
    
    	* cp-tree.h: Unpoison lvalue_p.
    	* call.c, class.c, constexpr.c, cvt.c, init.c, lambda.c, pt.c,
    	tree.c, typeck.c, typeck2.c: Use lvalue_p instead of
    	real_lvalue_p.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c90b8af..9b02814 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2925,7 +2925,7 @@  add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
 
 	  if (code == COND_EXPR)
 	    {
-	      if (real_lvalue_p (args[i]))
+	      if (lvalue_p (args[i]))
 		vec_safe_push (types[i], build_reference_type (argtypes[i]));
 
 	      vec_safe_push (types[i], TYPE_MAIN_VARIANT (argtypes[i]));
@@ -2962,7 +2962,7 @@  add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
 	}
       else
 	{
-	  if (code == COND_EXPR && real_lvalue_p (args[i]))
+	  if (code == COND_EXPR && lvalue_p (args[i]))
 	    vec_safe_push (types[i], build_reference_type (argtypes[i]));
 	  type = non_reference (argtypes[i]);
 	  if (i != 0 || ! ref1)
@@ -4554,7 +4554,7 @@  conditional_conversion (tree e1, tree e2, tsubst_flags_t complain)
      the constraint that the reference must bind directly.  */
   if (glvalue_p (e2))
     {
-      tree rtype = cp_build_reference_type (t2, !real_lvalue_p (e2));
+      tree rtype = cp_build_reference_type (t2, !lvalue_p (e2));
       conv = implicit_conversion (rtype,
 				  t1,
 				  e1,
@@ -4619,7 +4619,7 @@  build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
   tree arg3_type;
   tree result = NULL_TREE;
   tree result_type = NULL_TREE;
-  bool lvalue_p = true;
+  bool is_lvalue = true;
   struct z_candidate *candidates = 0;
   struct z_candidate *cand;
   void *p;
@@ -4636,7 +4636,7 @@  build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
 		 "ISO C++ forbids omitting the middle term of a ?: expression");
 
       /* Make sure that lvalues remain lvalues.  See g++.oliva/ext1.C.  */
-      if (real_lvalue_p (arg1))
+      if (lvalue_p (arg1))
 	arg2 = arg1 = cp_stabilize_reference (arg1);
       else
 	arg2 = arg1 = save_expr (arg1);
@@ -4871,7 +4871,7 @@  build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
 	  return error_mark_node;
 	}
 
-      lvalue_p = false;
+      is_lvalue = false;
       goto valid_operands;
     }
   /* [expr.cond]
@@ -4886,7 +4886,7 @@  build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
 		|| (same_type_ignoring_top_level_qualifiers_p (arg2_type,
 							       arg3_type)
 		    && glvalue_p (arg2) && glvalue_p (arg3)
-		    && real_lvalue_p (arg2) == real_lvalue_p (arg3))))
+		    && lvalue_p (arg2) == lvalue_p (arg3))))
     {
       conversion *conv2;
       conversion *conv3;
@@ -4984,7 +4984,7 @@  build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
      If the second and third operands are glvalues of the same value
      category and have the same type, the result is of that type and
      value category.  */
-  if (((real_lvalue_p (arg2) && real_lvalue_p (arg3))
+  if (((lvalue_p (arg2) && lvalue_p (arg3))
        || (xvalue_p (arg2) && xvalue_p (arg3)))
       && same_type_p (arg2_type, arg3_type))
     {
@@ -5001,7 +5001,7 @@  build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
      cv-qualified) class type, overload resolution is used to
      determine the conversions (if any) to be applied to the operands
      (_over.match.oper_, _over.built_).  */
-  lvalue_p = false;
+  is_lvalue = false;
   if (!same_type_p (arg2_type, arg3_type)
       && (CLASS_TYPE_P (arg2_type) || CLASS_TYPE_P (arg3_type)))
     {
@@ -5187,7 +5187,7 @@  build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
   /* We can't use result_type below, as fold might have returned a
      throw_expr.  */
 
-  if (!lvalue_p)
+  if (!is_lvalue)
     {
       /* Expand both sides into the same slot, hopefully the target of
 	 the ?: expression.  We used to check for TARGET_EXPRs here,
@@ -6694,10 +6694,10 @@  convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
 	  {
 	    tree extype = TREE_TYPE (expr);
 	    if (TYPE_REF_IS_RVALUE (ref_type)
-		&& real_lvalue_p (expr))
+		&& lvalue_p (expr))
 	      error_at (loc, "cannot bind %qT lvalue to %qT",
 			extype, totype);
-	    else if (!TYPE_REF_IS_RVALUE (ref_type) && !real_lvalue_p (expr)
+	    else if (!TYPE_REF_IS_RVALUE (ref_type) && !lvalue_p (expr)
 		     && !CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (ref_type)))
 	      error_at (loc, "invalid initialization of non-const reference of "
 			"type %qT from an rvalue of type %qT", totype, extype);
@@ -10042,7 +10042,7 @@  initialize_reference (tree type, tree expr,
 	    convert_like (conv, expr, complain);
 	  else if (!CP_TYPE_CONST_P (TREE_TYPE (type))
 		   && !TYPE_REF_IS_RVALUE (type)
-		   && !real_lvalue_p (expr))
+		   && !lvalue_p (expr))
 	    error_at (loc, "invalid initialization of non-const reference of "
 		      "type %qT from an rvalue of type %qT",
 		      type, TREE_TYPE (expr));
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 31fa4b0..b2db7f8 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -347,7 +347,7 @@  build_base_path (enum tree_code code,
 
   if (!want_pointer)
     {
-      rvalue = !real_lvalue_p (expr);
+      rvalue = !lvalue_p (expr);
       /* This must happen before the call to save_expr.  */
       expr = cp_build_addr_expr (expr, complain);
     }
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index ba40435..b9834a7 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -2620,7 +2620,7 @@  cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init,
 		      (atype, TREE_TYPE (init)));
 	  eltinit = cp_build_array_ref (input_location, init, idx,
 					tf_warning_or_error);
-	  if (!real_lvalue_p (init))
+	  if (!lvalue_p (init))
 	    eltinit = move (eltinit);
 	  eltinit = force_rvalue (eltinit, tf_warning_or_error);
 	  eltinit = (cxx_eval_constant_expression
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index a3e53a9..74b8c7c 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6516,10 +6516,6 @@  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 glvalue_p				(const_tree);
-/* obvalue_p used to be named lvalue_p, but that didn't match the C++
-   definition of lvalue.  For now, let's not use the name lvalue_p in the front
-   end; later we can rename real_lvalue_p to lvalue_p.  */
-#define lvalue_p(T) syntax error, use real_lvalue_p
 extern bool obvalue_p				(const_tree);
 extern bool xvalue_p	                        (const_tree);
 extern tree cp_stabilize_reference		(tree);
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 9dd383e..85b3047 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -317,7 +317,7 @@  build_up_reference (tree type, tree arg, int flags, tree decl,
 
   gcc_assert (TREE_CODE (type) == REFERENCE_TYPE);
 
-  if ((flags & DIRECT_BIND) && ! real_lvalue_p (arg))
+  if ((flags & DIRECT_BIND) && ! lvalue_p (arg))
     {
       /* Create a new temporary variable.  We can't just use a TARGET_EXPR
 	 here because it needs to live as long as DECL.  */
@@ -439,7 +439,7 @@  convert_to_reference (tree reftype, tree expr, int convtype,
 	= build_type_conversion (reftype, expr);
 
       if (rval_as_conversion && rval_as_conversion != error_mark_node
-	  && real_lvalue_p (rval_as_conversion))
+	  && lvalue_p (rval_as_conversion))
 	{
 	  expr = rval_as_conversion;
 	  rval_as_conversion = NULL_TREE;
@@ -457,7 +457,7 @@  convert_to_reference (tree reftype, tree expr, int convtype,
 	tree ttr = lvalue_type (expr);
 
 	if ((complain & tf_error)
-	    && ! real_lvalue_p (expr))
+	    && ! lvalue_p (expr))
 	  diagnose_ref_binding (loc, reftype, intype, decl);
 
 	if (! (convtype & CONV_CONST)
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 69ff61d..b4a4388 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3750,7 +3750,7 @@  static bool
 vec_copy_assign_is_trivial (tree inner_elt_type, tree init)
 {
   tree fromtype = inner_elt_type;
-  if (real_lvalue_p (init))
+  if (lvalue_p (init))
     fromtype = cp_build_reference_type (fromtype, /*rval*/false);
   return is_trivially_xible (MODIFY_EXPR, inner_elt_type, fromtype);
 }
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 41dc3fa..7e2590d 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -489,7 +489,7 @@  add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,
       if (by_reference_p)
 	{
 	  type = build_reference_type (type);
-	  if (!dependent_type_p (type) && !real_lvalue_p (initializer))
+	  if (!dependent_type_p (type) && !lvalue_p (initializer))
 	    error ("cannot capture %qE by reference", initializer);
 	}
       else
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index c5f65a7..a1b0ca9 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6533,7 +6533,7 @@  convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
 	  return NULL_TREE;
 	}
 
-      if (!real_lvalue_p (expr))
+      if (!lvalue_p (expr))
 	{
 	  if (complain & tf_error)
 	    error ("%qE is not a valid template argument for type %qT "
@@ -18046,7 +18046,7 @@  maybe_adjust_types_for_deduction (unification_kind_t strict,
       && TYPE_REF_IS_RVALUE (*parm)
       && TREE_CODE (TREE_TYPE (*parm)) == TEMPLATE_TYPE_PARM
       && cp_type_quals (TREE_TYPE (*parm)) == TYPE_UNQUALIFIED
-      && (arg_expr ? real_lvalue_p (arg_expr)
+      && (arg_expr ? lvalue_p (arg_expr)
 	  /* try_one_overload doesn't provide an arg_expr, but
 	     functions are always lvalues.  */
 	  : TREE_CODE (*arg) == FUNCTION_TYPE))
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 9fda74d..4cbf621 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -252,9 +252,7 @@  lvalue_kind (const_tree ref)
   return op1_lvalue_kind;
 }
 
-/* Returns the kind of lvalue that REF is, in the sense of
-   [basic.lval].  This function should really be named lvalue_p; it
-   computes the C++ definition of lvalue.  */
+/* Returns the kind of lvalue that REF is, in the sense of [basic.lval].  */
 
 cp_lvalue_kind
 real_lvalue_p (const_tree ref)
@@ -266,15 +264,15 @@  real_lvalue_p (const_tree ref)
     return kind;
 }
 
-/* Defined for c-common; the front end should use real_lvalue_p.  */
+/* c-common wants us to return bool.  */
 
 bool
-(lvalue_p) (const_tree t)
+lvalue_p (const_tree t)
 {
   return real_lvalue_p (t);
 }
 
-/* This differs from real_lvalue_p in that xvalues are included.  */
+/* This differs from lvalue_p in that xvalues are included.  */
 
 bool
 glvalue_p (const_tree ref)
@@ -615,7 +613,7 @@  build_vec_init_elt (tree type, tree init, tsubst_flags_t complain)
     {
       tree init_type = strip_array_types (TREE_TYPE (init));
       tree dummy = build_dummy_object (init_type);
-      if (!real_lvalue_p (init))
+      if (!lvalue_p (init))
 	dummy = move (dummy);
       argvec->quick_push (dummy);
     }
@@ -3331,7 +3329,7 @@  error_type (tree arg)
     ;
   else if (TREE_CODE (type) == ERROR_MARK)
     ;
-  else if (real_lvalue_p (arg))
+  else if (lvalue_p (arg))
     type = build_reference_type (lvalue_type (arg));
   else if (MAYBE_CLASS_TYPE_P (type))
     type = lvalue_type (arg);
@@ -4278,7 +4276,7 @@  stabilize_expr (tree exp, tree* initp)
     }
   else
     {
-      bool xval = !real_lvalue_p (exp);
+      bool xval = !lvalue_p (exp);
       exp = cp_build_addr_expr (exp, tf_warning_or_error);
       init_expr = get_target_expr (exp);
       exp = TARGET_EXPR_SLOT (init_expr);
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index a0e6c51..2f2beea 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6296,7 +6296,7 @@  build_x_conditional_expr (location_t loc, tree ifexp, tree op1, tree op2,
       /* Remember that the result is an lvalue or xvalue.  */
       if (glvalue_p (expr) && !glvalue_p (min))
 	TREE_TYPE (min) = cp_build_reference_type (TREE_TYPE (min),
-						   !real_lvalue_p (expr));
+						   !lvalue_p (expr));
       expr = convert_from_reference (min);
     }
   return expr;
@@ -6535,7 +6535,7 @@  maybe_warn_about_useless_cast (tree type, tree expr, tsubst_flags_t complain)
     {
       if ((TREE_CODE (type) == REFERENCE_TYPE
 	   && (TYPE_REF_IS_RVALUE (type)
-	       ? xvalue_p (expr) : real_lvalue_p (expr))
+	       ? xvalue_p (expr) : lvalue_p (expr))
 	   && same_type_p (TREE_TYPE (expr), TREE_TYPE (type)))
 	  || same_type_p (TREE_TYPE (expr), type))
 	warning (OPT_Wuseless_cast, "useless cast to type %qT", type);
@@ -6637,7 +6637,7 @@  build_static_cast_1 (tree type, tree expr, bool c_cast_p,
   if (TREE_CODE (type) == REFERENCE_TYPE
       && CLASS_TYPE_P (TREE_TYPE (type))
       && CLASS_TYPE_P (intype)
-      && (TYPE_REF_IS_RVALUE (type) || real_lvalue_p (expr))
+      && (TYPE_REF_IS_RVALUE (type) || lvalue_p (expr))
       && DERIVED_FROM_P (intype, TREE_TYPE (type))
       && can_convert (build_pointer_type (TYPE_MAIN_VARIANT (intype)),
 		      build_pointer_type (TYPE_MAIN_VARIANT
@@ -6984,7 +6984,7 @@  build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
      reinterpret_cast.  */
   if (TREE_CODE (type) == REFERENCE_TYPE)
     {
-      if (! real_lvalue_p (expr))
+      if (! lvalue_p (expr))
 	{
           if (complain & tf_error)
             error ("invalid cast of an rvalue expression of type "
@@ -7231,7 +7231,7 @@  build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain,
     {
       reference_type = dst_type;
       if (!TYPE_REF_IS_RVALUE (dst_type)
-	  ? real_lvalue_p (expr)
+	  ? lvalue_p (expr)
 	  : obvalue_p (expr))
 	/* OK.  */;
       else
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 65d91c9..b1206c0 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1895,7 +1895,7 @@  build_m_component_ref (tree datum, tree component, tsubst_flags_t complain)
 	 operand is a pointer to member function with ref-qualifier &&.  */
       if (FUNCTION_REF_QUALIFIED (type))
 	{
-	  bool lval = real_lvalue_p (datum);
+	  bool lval = lvalue_p (datum);
 	  if (lval && FUNCTION_RVALUE_QUALIFIED (type))
 	    {
 	      if (complain & tf_error)