@@ -593,6 +593,14 @@ class type : public memento
593
593
594
594
virtual bool is_same_type_as (type *other)
595
595
{
596
+ if (is_int ()
597
+ && other->is_int ()
598
+ && get_size () == other->get_size ()
599
+ && is_signed () == other->is_signed ())
600
+ {
601
+ /* LHS (this) is an integer of the same size and sign as rtype. */
602
+ return true ;
603
+ }
596
604
return this == other;
597
605
}
598
606
@@ -609,6 +617,7 @@ class type : public memento
609
617
virtual type *is_volatile () { return NULL ; }
610
618
virtual type *is_restrict () { return NULL ; }
611
619
virtual type *is_const () { return NULL ; }
620
+ virtual type *is_aligned () { return NULL ; }
612
621
virtual type *is_array () = 0;
613
622
virtual struct_ *is_struct () { return NULL ; }
614
623
virtual bool is_union () const { return false ; }
@@ -672,13 +681,6 @@ class memento_of_get_type : public type
672
681
accept it: */
673
682
return true ;
674
683
}
675
- } else if (is_int ()
676
- && rtype->is_int ()
677
- && get_size () == rtype->get_size ()
678
- && is_signed () == rtype->is_signed ())
679
- {
680
- /* LHS (this) is an integer of the same size and sign as rtype. */
681
- return true ;
682
684
}
683
685
684
686
return type::accepts_writes_from (rtype);
@@ -882,6 +884,18 @@ class memento_of_get_aligned : public decorated_type
882
884
return result;
883
885
}
884
886
887
+ bool is_same_type_as (type *other) final override
888
+ {
889
+ // TODO: check if outermost alignment is equal?
890
+ if (!other->is_aligned ())
891
+ {
892
+ return m_other_type->is_same_type_as (other);
893
+ }
894
+ return m_other_type->is_same_type_as (other->is_aligned ());
895
+ }
896
+
897
+ type *is_aligned () final override { return m_other_type; }
898
+
885
899
/* Strip off the alignment, giving the underlying type. */
886
900
type *unqualified () final override { return m_other_type; }
887
901
0 commit comments