[8/8] c++, lto: Use TYPE_REF_IS_LVALUE

Message ID 20230718233301.28677-9-kmatsui@gcc.gnu.org
State Unresolved
Headers
Series Tweak predicate macros in tree |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Ken Matsui July 18, 2023, 11:12 p.m. UTC
  gcc/cp/ChangeLog:

	* decl.cc (copy_fn_p): Use TYPE_REF_IS_LVALUE.
	* init.cc (maybe_warn_list_ctor): Likewise.
	* method.cc (early_check_defaulted_comparison): Likewise.
	* pt.cc (maybe_adjust_types_for_deduction): Likewise.
	(invalid_nontype_parm_type_p): Likewise.
	* tree.cc (structural_type_p): Likewise.

gcc/lto/ChangeLog:

	* lto-common.cc (lto_fixup_prevailing_type): Use
	TYPE_REF_IS_LVALUE.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 gcc/cp/decl.cc        | 3 +--
 gcc/cp/init.cc        | 3 +--
 gcc/cp/method.cc      | 3 +--
 gcc/cp/pt.cc          | 6 ++----
 gcc/cp/tree.cc        | 2 +-
 gcc/lto/lto-common.cc | 2 +-
 6 files changed, 7 insertions(+), 12 deletions(-)
  

Patch

diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index c08056ca3d2..5e84f6a6f78 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -15250,8 +15250,7 @@  copy_fn_p (const_tree d)
       /* Pass by value copy assignment operator.  */
       result = -1;
     }
-  else if (TYPE_REF_P (arg_type)
-	   && !TYPE_REF_IS_RVALUE (arg_type)
+  else if (TYPE_REF_IS_LVALUE (arg_type)
 	   && TYPE_MAIN_VARIANT (TREE_TYPE (arg_type)) == DECL_CONTEXT (d))
     {
       if (CP_TYPE_CONST_P (TREE_TYPE (arg_type)))
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index 01eb4b55889..8006576bfd6 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -778,8 +778,7 @@  maybe_warn_list_ctor (tree member, tree init)
   tree initlist = non_reference (parm);
 
   /* Do not warn if the parameter is an lvalue reference to non-const.  */
-  if (TYPE_REF_P (parm) && !TYPE_REF_IS_RVALUE (parm)
-      && !CP_TYPE_CONST_P (initlist))
+  if (TYPE_REF_IS_LVALUE (parm) && !CP_TYPE_CONST_P (initlist))
     return;
 
   tree targs = CLASSTYPE_TI_ARGS (initlist);
diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc
index 524efc4e260..59be43d12c6 100644
--- a/gcc/cp/method.cc
+++ b/gcc/cp/method.cc
@@ -1207,8 +1207,7 @@  early_check_defaulted_comparison (tree fn)
       tree parmtype = TREE_VALUE (parmnode);
       if (CLASS_TYPE_P (parmtype))
 	saw_byval = true;
-      else if (TYPE_REF_P (parmtype)
-	       && !TYPE_REF_IS_RVALUE (parmtype)
+      else if (TYPE_REF_IS_LVALUE (parmtype)
 	       && TYPE_QUALS (TREE_TYPE (parmtype)) == TYPE_QUAL_CONST)
 	{
 	  saw_byref = true;
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index cb82e1b268b..56207411a7d 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -22772,8 +22772,7 @@  maybe_adjust_types_for_deduction (tree tparms,
 	 too, but here handle it by stripping the reference from PARM
 	 rather than by adding it to ARG.  */
       if (forwarding_reference_p (*parm, TPARMS_PRIMARY_TEMPLATE (tparms))
-	  && TYPE_REF_P (*arg)
-	  && !TYPE_REF_IS_RVALUE (*arg))
+	  && TYPE_REF_IS_LVALUE (*arg))
 	*parm = TREE_TYPE (*parm);
       /* Nothing else to do in this case.  */
       return 0;
@@ -27595,8 +27594,7 @@  invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain)
     return false;
   else if (TYPE_PTR_P (type))
     return false;
-  else if (TYPE_REF_P (type)
-	   && !TYPE_REF_IS_RVALUE (type))
+  else if (TYPE_REF_IS_LVALUE (type))
     return false;
   else if (TYPE_PTRMEM_P (type))
     return false;
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index 799183dc646..1ba7539b497 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -4928,7 +4928,7 @@  structural_type_p (tree t, bool explain)
   if (SCALAR_TYPE_P (t))
     return true;
   /* an lvalue reference type, or */
-  if (TYPE_REF_P (t) && !TYPE_REF_IS_RVALUE (t))
+  if (TYPE_REF_IS_LVALUE (t))
     return true;
   /* a literal class type with the following properties:
      - all base classes and non-static data members are public and non-mutable
diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
index 4b748ced87f..6321a70d04a 100644
--- a/gcc/lto/lto-common.cc
+++ b/gcc/lto/lto-common.cc
@@ -998,7 +998,7 @@  lto_fixup_prevailing_type (tree t)
 	  TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (TREE_TYPE (t));
 	  TYPE_POINTER_TO (TREE_TYPE (t)) = t;
 	}
-      else if (TYPE_REF_P (t) && !TYPE_REF_IS_RVALUE (t))
+      else if (TYPE_REF_IS_LVALUE (t))
 	{
 	  TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (TREE_TYPE (t));
 	  TYPE_REFERENCE_TO (TREE_TYPE (t)) = t;