@@ -605,6 +605,7 @@ class type : public memento
605
605
virtual function_type *as_a_function_type () { gcc_unreachable (); return NULL ; }
606
606
virtual struct_ *dyn_cast_struct () { return NULL ; }
607
607
virtual vector_type *dyn_cast_vector_type () { return NULL ; }
608
+ virtual array_type *dyn_cast_array_type () { return NULL ; }
608
609
609
610
/* Is it typesafe to copy to this type from rtype? */
610
611
virtual bool accepts_writes_from (type *rtype)
@@ -823,6 +824,11 @@ class memento_of_get_const : public decorated_type
823
824
824
825
void replay_into (replayer *) final override ;
825
826
827
+ array_type *dyn_cast_array_type () final override
828
+ {
829
+ return m_other_type->dyn_cast_array_type ();
830
+ }
831
+
826
832
private:
827
833
string * make_debug_string () final override ;
828
834
void write_reproducer (reproducer &r) final override ;
@@ -1001,6 +1007,17 @@ class array_type : public type
1001
1007
1002
1008
type *dereference () final override ;
1003
1009
1010
+ bool is_same_type_as (type *other) final override
1011
+ {
1012
+ array_type *other_array_type = other->dyn_cast_array_type ();
1013
+ if (!other_array_type)
1014
+ return false ;
1015
+ return m_num_elements == other_array_type->m_num_elements
1016
+ && m_element_type->is_same_type_as (other_array_type->m_element_type );
1017
+ }
1018
+
1019
+ array_type *dyn_cast_array_type () final override { return this ; }
1020
+
1004
1021
type* copy (context* ctxt) final override
1005
1022
{
1006
1023
type* result = new array_type (ctxt, m_loc, m_element_type->copy (ctxt), m_num_elements);
0 commit comments