diff mbox series

[COMMITTED] Remove unneeded vrange_traits.

Message ID 20220603073219.2683070-2-aldyh@redhat.com
State New
Headers show
Series [COMMITTED] Remove unneeded vrange_traits. | expand

Commit Message

Aldy Hernandez June 3, 2022, 7:32 a.m. UTC
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 mbox series

Patch

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.