From: Ken Matsui <kmatsui@gcc.gnu.org>
To: gcc-patches@gcc.gnu.org
Cc: Ken Matsui <kmatsui@gcc.gnu.org>
Subject: [PATCH 8/8] c++, lto: Use TYPE_REF_IS_LVALUE
Date: Tue, 18 Jul 2023 16:12:50 -0700 [thread overview]
Message-ID: <20230718233301.28677-9-kmatsui@gcc.gnu.org> (raw)
In-Reply-To: <20230718233301.28677-1-kmatsui@gcc.gnu.org>
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(-)
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;
--
2.41.0
next prev parent reply other threads:[~2023-07-18 23:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 23:12 [PATCH 0/8] Tweak predicate macros in tree Ken Matsui
2023-07-18 23:12 ` [PATCH 1/8] c++, tree: Move TYPE_REF_P to tree.h Ken Matsui
2023-07-18 23:12 ` [PATCH 2/8] gcc: Use TYPE_REF_P Ken Matsui
2023-07-18 23:12 ` [PATCH 3/8] c++, tree: Move TYPE_PTR_P to tree.h Ken Matsui
2023-07-18 23:12 ` [PATCH 4/8] c++, tree: Move INDIRECT_TYPE_P " Ken Matsui
2023-07-18 23:12 ` [PATCH 5/8] gcc: Use INDIRECT_TYPE_P instead of POINTER_TYPE_P Ken Matsui
2023-07-18 23:12 ` [PATCH 6/8] tree: Remove POINTER_TYPE_P Ken Matsui
2023-07-18 23:12 ` [PATCH 7/8] tree: Define TYPE_REF_IS_LVALUE Ken Matsui
2023-07-18 23:12 ` Ken Matsui [this message]
2023-07-19 7:07 ` [PATCH 0/8] Tweak predicate macros in tree Richard Biener
2023-07-19 17:27 ` Ken Matsui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230718233301.28677-9-kmatsui@gcc.gnu.org \
--to=kmatsui@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).