]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use lvalue_p instead of real_lvalue_p.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Jul 2016 21:32:18 +0000 (21:32 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Jul 2016 21:32:18 +0000 (21:32 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238183 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/constexpr.c
gcc/cp/cp-tree.h
gcc/cp/cvt.c
gcc/cp/init.c
gcc/cp/lambda.c
gcc/cp/pt.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/cp/typeck2.c

index 8d8535d792107dff2c9af23d7cb03f0b7917b086..e70e102c6e35d93138dad5e0fdc5da3bb43be0f4 100644 (file)
@@ -1,5 +1,10 @@
 2016-07-08  Jason Merrill  <jason@redhat.com>
 
+       * 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.
+
        * tree.c (obvalue_p): Rename from lvalue_p.
        (lvalue_p): Define for c-common.
        * call.c, cp-tree.h, cvt.c, init.c: Adjust.
index c90b8af115f6a4f80c4994d0cae131663dd5e20e..9b028144aaa6f27faff66e086a47fdbf26271476 100644 (file)
@@ -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));
index 31fa4b03136a0b4d187bfbc6f5a93bd1cc1b4fbd..b2db7f8aab83e0687c69308ff36495e677ba34f8 100644 (file)
@@ -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);
     }
index ba40435ef67d4ae130a83b5d0c5b809723027d9b..b9834a7e734dd938ad2e55a79df4c6e991529ab7 100644 (file)
@@ -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
index a3e53a9c109795f5ad64262b4dfbd852375288d6..74b8c7c7963ca5a2c2519c03b0711c69fe14d520 100644 (file)
@@ -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);
index 9dd383e068142b16411a3a99599d656f4319e856..85b3047d9f138d08f9c94ca2116d4293cb6c3608 100644 (file)
@@ -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)
index 69ff61d72adb4b6ae91b365eea30079cfb8d9a67..b4a4388d705b9f3616aacda527228210edb19d6f 100644 (file)
@@ -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);
 }
index 3822882accad7b32b1dded529ebb4c0ef9ffe290..4d6d80fe128ddb6b95285f598a40f0fa2b738b58 100644 (file)
@@ -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
index c5f65a7f6772b8b5dd2ba4048ddd63c8b4f3ae73..a1b0ca9a85858cb2293d95a54afc25cec9683f01 100644 (file)
@@ -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))
index 9fda74db2dacbb688365d4cd3184bd032039d531..4cbf6215a13a294e911f8737f62f2c5a46aa927e 100644 (file)
@@ -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);
index a0e6c519a961a588286e9ece80210fa37b44fb8d..2f2beead74cbc60f83014e20403deca977e3c146 100644 (file)
@@ -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
index 65d91c97784997f26351f3bb86ef33ae57b90ae9..b1206c09a0e35551a42f831ff3eab0d8220fb970 100644 (file)
@@ -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)