@@ -35,23 +35,13 @@ class qualifierst
3535public:
3636 virtual std::unique_ptr<qualifierst> clone () const = 0;
3737
38- virtual qualifierst &operator +=(const qualifierst &b) = 0 ;
39-
4038 virtual std::size_t count () const = 0;
4139
4240 virtual void clear () = 0;
4341
4442 virtual void read (const typet &src) = 0;
4543 virtual void write (typet &src) const = 0;
4644
47- // Comparisons
48- virtual bool is_subset_of (const qualifierst &q) const = 0;
49- virtual bool operator ==(const qualifierst &other) const = 0 ;
50- bool operator !=(const qualifierst &other) const
51- {
52- return !(*this == other);
53- }
54-
5545 // String conversion
5646 virtual std::string as_string () const = 0;
5747 friend std::ostream &operator <<(std::ostream &, const qualifierst &);
@@ -107,41 +97,47 @@ class c_qualifierst : public qualifierst
10797
10898 static void clear (typet &dest);
10999
110- virtual bool is_subset_of (const qualifierst &other) const override
100+ bool is_subset_of (const c_qualifierst &other) const
111101 {
112- const c_qualifierst *cq = dynamic_cast < const c_qualifierst *>(& other);
113- return (!is_constant || cq-> is_constant ) &&
114- (!is_volatile || cq-> is_volatile ) &&
115- (!is_restricted || cq-> is_restricted ) &&
116- (!is_atomic || cq-> is_atomic ) && (!is_ptr32 || cq-> is_ptr32 ) &&
117- (!is_ptr64 || cq-> is_ptr64 ) && (! is_nodiscard || cq-> is_nodiscard ) &&
118- (!is_noreturn || cq-> is_noreturn );
102+ return (!is_constant || other. is_constant ) &&
103+ (!is_volatile || other. is_volatile ) &&
104+ (!is_restricted || other. is_restricted ) &&
105+ (!is_atomic || other. is_atomic ) && (!is_ptr32 || other. is_ptr32 ) &&
106+ (!is_ptr64 || other. is_ptr64 ) &&
107+ (!is_nodiscard || other. is_nodiscard ) &&
108+ (!is_noreturn || other. is_noreturn );
119109
120110 // is_transparent_union isn't checked
121111 }
122112
123- virtual bool operator ==(const qualifierst &other) const override
113+ bool operator ==(const c_qualifierst &other) const
124114 {
125- const c_qualifierst *cq = dynamic_cast <const c_qualifierst *>(&other);
126- return is_constant == cq->is_constant && is_volatile == cq->is_volatile &&
127- is_restricted == cq->is_restricted && is_atomic == cq->is_atomic &&
128- is_ptr32 == cq->is_ptr32 && is_ptr64 == cq->is_ptr64 &&
129- is_transparent_union == cq->is_transparent_union &&
130- is_nodiscard == cq->is_nodiscard && is_noreturn == cq->is_noreturn ;
115+ return is_constant == other.is_constant &&
116+ is_volatile == other.is_volatile &&
117+ is_restricted == other.is_restricted &&
118+ is_atomic == other.is_atomic && is_ptr32 == other.is_ptr32 &&
119+ is_ptr64 == other.is_ptr64 &&
120+ is_transparent_union == other.is_transparent_union &&
121+ is_nodiscard == other.is_nodiscard &&
122+ is_noreturn == other.is_noreturn ;
123+ }
124+
125+ bool operator !=(const c_qualifierst &other) const
126+ {
127+ return !(*this == other);
131128 }
132129
133- virtual qualifierst &operator +=(const qualifierst &other) override
130+ c_qualifierst &operator +=(const c_qualifierst &other)
134131 {
135- const c_qualifierst *cq = dynamic_cast <const c_qualifierst *>(&other);
136- is_constant |= cq->is_constant ;
137- is_volatile |= cq->is_volatile ;
138- is_restricted |= cq->is_restricted ;
139- is_atomic |= cq->is_atomic ;
140- is_ptr32 |= cq->is_ptr32 ;
141- is_ptr64 |= cq->is_ptr64 ;
142- is_transparent_union |= cq->is_transparent_union ;
143- is_nodiscard |= cq->is_nodiscard ;
144- is_noreturn |= cq->is_noreturn ;
132+ is_constant |= other.is_constant ;
133+ is_volatile |= other.is_volatile ;
134+ is_restricted |= other.is_restricted ;
135+ is_atomic |= other.is_atomic ;
136+ is_ptr32 |= other.is_ptr32 ;
137+ is_ptr64 |= other.is_ptr64 ;
138+ is_transparent_union |= other.is_transparent_union ;
139+ is_nodiscard |= other.is_nodiscard ;
140+ is_noreturn |= other.is_noreturn ;
145141 return *this ;
146142 }
147143
0 commit comments