public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Cc: Andrew MacLeod <amacleod@redhat.com>, Aldy Hernandez <aldyh@redhat.com>
Subject: [COMMITTED] Add Value_Range::operator=.
Date: Wed, 17 May 2023 16:10:20 +0200	[thread overview]
Message-ID: <20230517141020.464106-2-aldyh@redhat.com> (raw)
In-Reply-To: <20230517141020.464106-1-aldyh@redhat.com>

gcc/ChangeLog:

	* value-range.h (Value_Range::operator=): New.
---
 gcc/value-range.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gcc/value-range.h b/gcc/value-range.h
index ab982d18402..af81d6080da 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -523,6 +523,7 @@ public:
   Value_Range (const Value_Range &);
   void set_type (tree type);
   vrange& operator= (const vrange &);
+  Value_Range& operator= (const Value_Range &);
   bool operator== (const Value_Range &r) const;
   bool operator!= (const Value_Range &r) const;
   operator vrange &();
@@ -642,6 +643,30 @@ Value_Range::operator= (const vrange &r)
   return *m_vrange;
 }
 
+inline Value_Range &
+Value_Range::operator= (const Value_Range &r)
+{
+  if (r.m_vrange == &r.m_irange)
+    {
+      m_irange = r.m_irange;
+      m_vrange = &m_irange;
+    }
+  else if (r.m_vrange == &r.m_frange)
+    {
+      m_frange = r.m_frange;
+      m_vrange = &m_frange;
+    }
+  else if (r.m_vrange == &r.m_unsupported)
+    {
+      m_unsupported = r.m_unsupported;
+      m_vrange = &m_unsupported;
+    }
+  else
+    gcc_unreachable ();
+
+  return *this;
+}
+
 inline bool
 Value_Range::operator== (const Value_Range &r) const
 {
-- 
2.40.0


      reply	other threads:[~2023-05-17 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 14:10 [COMMITTED] Provide support for copying unsupported ranges Aldy Hernandez
2023-05-17 14:10 ` Aldy Hernandez [this message]

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=20230517141020.464106-2-aldyh@redhat.com \
    --to=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --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).