public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-977] Remove unneeded vrange_traits.
@ 2022-06-03  8:40 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-06-03  8:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f4fa81ba63299030d068327f3d90920de8c54d1c

commit r13-977-gf4fa81ba63299030d068327f3d90920de8c54d1c
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Jun 1 17:41:10 2022 +0200

    Remove unneeded vrange_traits.
    
    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.

Diff:
---
 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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-03  8:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03  8:40 [gcc r13-977] Remove unneeded vrange_traits Aldy Hernandez

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).