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>
Subject: [COMMITTED] Remove unneeded vrange_traits.
Date: Fri,  3 Jun 2022 09:32:18 +0200	[thread overview]
Message-ID: <20220603073219.2683070-2-aldyh@redhat.com> (raw)
In-Reply-To: <20220603073219.2683070-1-aldyh@redhat.com>

The traits struct is no longer needed.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* value-range.h (struct vrange_traits): Remove.
	(is_a): Rewrite without vrange_traits.
	(as_a): Same.
---
 gcc/value-range.h | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/gcc/value-range.h b/gcc/value-range.h
index 61e6a1887d5..26e41ed2982 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -245,24 +245,12 @@ public:
   virtual void dump (FILE *) const override;
 };
 
-// Traits to implement vrange is_a<> and as_a<>.
-
-template<typename T>
-struct vrange_traits
-{
-  // Default to something unusable.
-  typedef void range_type;
-};
-
-template<>
-struct vrange_traits<irange>
-{
-  typedef irange range_type;
-};
+// is_a<> and as_a<> implementation for vrange.
 
+// Anything we haven't specialized is a hard fail.
 template <typename T>
 inline bool
-is_a (vrange &v)
+is_a (vrange &)
 {
   gcc_unreachable ();
   return false;
@@ -281,18 +269,16 @@ template <typename T>
 inline T &
 as_a (vrange &v)
 {
-  typedef typename vrange_traits<T>::range_type range_type;
-  gcc_checking_assert (is_a <range_type> (v));
-  return static_cast <range_type &> (v);
+  gcc_checking_assert (is_a <T> (v));
+  return static_cast <T &> (v);
 }
 
 template <typename T>
 inline const T &
 as_a (const vrange &v)
 {
-  typedef typename vrange_traits<T>::range_type range_type;
-  gcc_checking_assert (is_a <range_type> (v));
-  return static_cast <const range_type &> (v);
+  gcc_checking_assert (is_a <T> (v));
+  return static_cast <const T &> (v);
 }
 
 // Specializations for the different range types.
-- 
2.36.1


  reply	other threads:[~2022-06-03  7:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  7:32 [COMMITTED] Flesh out unsupported_range Aldy Hernandez
2022-06-03  7:32 ` Aldy Hernandez [this message]
2022-06-03  7:32 ` [COMMITTED] Misc range temporary fixes Aldy Hernandez

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