@@ -35,23 +35,13 @@ class qualifierst
35
35
public:
36
36
virtual std::unique_ptr<qualifierst> clone () const = 0;
37
37
38
- virtual qualifierst &operator +=(const qualifierst &b) = 0 ;
39
-
40
38
virtual std::size_t count () const = 0;
41
39
42
40
virtual void clear () = 0;
43
41
44
42
virtual void read (const typet &src) = 0;
45
43
virtual void write (typet &src) const = 0;
46
44
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
-
55
45
// String conversion
56
46
virtual std::string as_string () const = 0;
57
47
friend std::ostream &operator <<(std::ostream &, const qualifierst &);
@@ -107,41 +97,47 @@ class c_qualifierst : public qualifierst
107
97
108
98
static void clear (typet &dest);
109
99
110
- virtual bool is_subset_of (const qualifierst &other) const override
100
+ bool is_subset_of (const c_qualifierst &other) const
111
101
{
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 );
119
109
120
110
// is_transparent_union isn't checked
121
111
}
122
112
123
- virtual bool operator ==(const qualifierst &other) const override
113
+ bool operator ==(const c_qualifierst &other) const
124
114
{
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);
131
128
}
132
129
133
- virtual qualifierst &operator +=(const qualifierst &other) override
130
+ c_qualifierst &operator +=(const c_qualifierst &other)
134
131
{
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 ;
145
141
return *this ;
146
142
}
147
143
0 commit comments