/work/obj-fuzz/dist/include/mozilla/EnumSet.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | /* A set abstraction for enumeration values. */ |
8 | | |
9 | | #ifndef mozilla_EnumSet_h |
10 | | #define mozilla_EnumSet_h |
11 | | |
12 | | #include "mozilla/Assertions.h" |
13 | | #include "mozilla/Attributes.h" |
14 | | |
15 | | #include <initializer_list> |
16 | | #include <type_traits> |
17 | | |
18 | | #include <stdint.h> |
19 | | |
20 | | namespace mozilla { |
21 | | |
22 | | /** |
23 | | * EnumSet<T, U> is a set of values defined by an enumeration. It is implemented |
24 | | * using a bit mask with the size of U for each value. It works both for enum |
25 | | * and enum class types. |
26 | | */ |
27 | | template<typename T, |
28 | | typename Serialized = typename std::make_unsigned<typename std::underlying_type<T>::type>::type> |
29 | | class EnumSet |
30 | | { |
31 | | public: |
32 | | |
33 | | EnumSet() |
34 | | : mBitField(0) |
35 | 16 | { |
36 | 16 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::VMFlag, unsigned int>::EnumSet() Unexecuted instantiation: mozilla::EnumSet<mozilla::MemoryMapping::Perm, unsigned char>::EnumSet() mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>::EnumSet() Line | Count | Source | 35 | 16 | { | 36 | 16 | } |
Unexecuted instantiation: mozilla::EnumSet<mozilla::layers::ScrollDirection, unsigned int>::EnumSet() Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::EnumSet() Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::EnumSet() Unexecuted instantiation: mozilla::EnumSet<nsMencloseNotation, unsigned int>::EnumSet() Unexecuted instantiation: mozilla::EnumSet<mozilla::LayerActivity::ActivityIndex, unsigned int>::EnumSet() Unexecuted instantiation: mozilla::EnumSet<mozilla::ct::VerifiedSCT::Origin, unsigned int>::EnumSet() Unexecuted instantiation: mozilla::EnumSet<js::gc::AllocKind, unsigned int>::EnumSet() |
37 | | |
38 | | MOZ_IMPLICIT EnumSet(T aEnum) |
39 | | : mBitField(bitFor(aEnum)) |
40 | 0 | { } Unexecuted instantiation: mozilla::EnumSet<mozilla::CreateDecoderParams::Option, unsigned int>::EnumSet(mozilla::CreateDecoderParams::Option) Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::EnumSet(mozilla::TrackInfo::TrackType) Unexecuted instantiation: mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char>::EnumSet(mozilla::AccessibleCaretManager::UpdateCaretsHint) |
41 | | |
42 | | EnumSet(T aEnum1, T aEnum2) |
43 | | : mBitField(bitFor(aEnum1) | |
44 | | bitFor(aEnum2)) |
45 | 0 | { |
46 | 0 | } |
47 | | |
48 | | EnumSet(T aEnum1, T aEnum2, T aEnum3) |
49 | | : mBitField(bitFor(aEnum1) | |
50 | | bitFor(aEnum2) | |
51 | | bitFor(aEnum3)) |
52 | | { |
53 | | } |
54 | | |
55 | | EnumSet(T aEnum1, T aEnum2, T aEnum3, T aEnum4) |
56 | | : mBitField(bitFor(aEnum1) | |
57 | | bitFor(aEnum2) | |
58 | | bitFor(aEnum3) | |
59 | | bitFor(aEnum4)) |
60 | | { |
61 | | } |
62 | | |
63 | | MOZ_IMPLICIT EnumSet(std::initializer_list<T> list) |
64 | | : mBitField(0) |
65 | 30 | { |
66 | 156 | for (auto value : list) { |
67 | 156 | (*this) += value; |
68 | 156 | } |
69 | 30 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char>::EnumSet(std::initializer_list<mozilla::AccessibleCaretManager::UpdateCaretsHint>) mozilla::EnumSet<js::gc::AllocKind, unsigned int>::EnumSet(std::initializer_list<js::gc::AllocKind>) Line | Count | Source | 65 | 30 | { | 66 | 156 | for (auto value : list) { | 67 | 156 | (*this) += value; | 68 | 156 | } | 69 | 30 | } |
|
70 | | |
71 | | EnumSet(const EnumSet& aEnumSet) |
72 | | : mBitField(aEnumSet.mBitField) |
73 | 120 | { |
74 | 120 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::MemoryMapping::Perm, unsigned char>::EnumSet(mozilla::EnumSet<mozilla::MemoryMapping::Perm, unsigned char> const&) Unexecuted instantiation: mozilla::EnumSet<mozilla::VMFlag, unsigned int>::EnumSet(mozilla::EnumSet<mozilla::VMFlag, unsigned int> const&) Unexecuted instantiation: mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>::EnumSet(mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char> const&) Unexecuted instantiation: mozilla::EnumSet<mozilla::CreateDecoderParams::Option, unsigned int>::EnumSet(mozilla::EnumSet<mozilla::CreateDecoderParams::Option, unsigned int> const&) Unexecuted instantiation: mozilla::EnumSet<mozilla::layers::ScrollDirection, unsigned int>::EnumSet(mozilla::EnumSet<mozilla::layers::ScrollDirection, unsigned int> const&) Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::EnumSet(mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int> const&) Unexecuted instantiation: mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char>::EnumSet(mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char> const&) mozilla::EnumSet<js::gc::AllocKind, unsigned int>::EnumSet(mozilla::EnumSet<js::gc::AllocKind, unsigned int> const&) Line | Count | Source | 73 | 120 | { | 74 | 120 | } |
|
75 | | |
76 | | /** |
77 | | * Add an element |
78 | | */ |
79 | | void operator+=(T aEnum) |
80 | 161 | { |
81 | 161 | incVersion(); |
82 | 161 | mBitField |= bitFor(aEnum); |
83 | 161 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::operator+=(mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED) Unexecuted instantiation: mozilla::EnumSet<mozilla::MemoryMapping::Perm, unsigned char>::operator+=(mozilla::MemoryMapping::Perm) Unexecuted instantiation: mozilla::EnumSet<mozilla::VMFlag, unsigned int>::operator+=(mozilla::VMFlag) mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>::operator+=(mozilla::loader::ProcessType) Line | Count | Source | 80 | 5 | { | 81 | 5 | incVersion(); | 82 | 5 | mBitField |= bitFor(aEnum); | 83 | 5 | } |
Unexecuted instantiation: mozilla::EnumSet<mozilla::layers::ScrollDirection, unsigned int>::operator+=(mozilla::layers::ScrollDirection) Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::operator+=(mozilla::TrackInfo::TrackType) Unexecuted instantiation: mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char>::operator+=(mozilla::AccessibleCaretManager::UpdateCaretsHint) Unexecuted instantiation: mozilla::EnumSet<nsMencloseNotation, unsigned int>::operator+=(nsMencloseNotation) Unexecuted instantiation: mozilla::EnumSet<mozilla::LayerActivity::ActivityIndex, unsigned int>::operator+=(mozilla::LayerActivity::ActivityIndex) Unexecuted instantiation: mozilla::EnumSet<mozilla::ct::VerifiedSCT::Origin, unsigned int>::operator+=(mozilla::ct::VerifiedSCT::Origin) mozilla::EnumSet<js::gc::AllocKind, unsigned int>::operator+=(js::gc::AllocKind) Line | Count | Source | 80 | 156 | { | 81 | 156 | incVersion(); | 82 | 156 | mBitField |= bitFor(aEnum); | 83 | 156 | } |
|
84 | | |
85 | | /** |
86 | | * Add an element |
87 | | */ |
88 | | EnumSet operator+(T aEnum) const |
89 | | { |
90 | | EnumSet result(*this); |
91 | | result += aEnum; |
92 | | return result; |
93 | | } |
94 | | |
95 | | /** |
96 | | * Union |
97 | | */ |
98 | | void operator+=(const EnumSet aEnumSet) |
99 | 0 | { |
100 | 0 | incVersion(); |
101 | 0 | mBitField |= aEnumSet.mBitField; |
102 | 0 | } |
103 | | |
104 | | /** |
105 | | * Union |
106 | | */ |
107 | | EnumSet operator+(const EnumSet aEnumSet) const |
108 | | { |
109 | | EnumSet result(*this); |
110 | | result += aEnumSet; |
111 | | return result; |
112 | | } |
113 | | |
114 | | /** |
115 | | * Remove an element |
116 | | */ |
117 | | void operator-=(T aEnum) |
118 | 0 | { |
119 | 0 | incVersion(); |
120 | 0 | mBitField &= ~(bitFor(aEnum)); |
121 | 0 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::operator-=(mozilla::TrackInfo::TrackType) Unexecuted instantiation: mozilla::EnumSet<nsMencloseNotation, unsigned int>::operator-=(nsMencloseNotation) |
122 | | |
123 | | /** |
124 | | * Remove an element |
125 | | */ |
126 | | EnumSet operator-(T aEnum) const |
127 | | { |
128 | | EnumSet result(*this); |
129 | | result -= aEnum; |
130 | | return result; |
131 | | } |
132 | | |
133 | | /** |
134 | | * Remove a set of elements |
135 | | */ |
136 | | void operator-=(const EnumSet aEnumSet) |
137 | 0 | { |
138 | 0 | incVersion(); |
139 | 0 | mBitField &= ~(aEnumSet.mBitField); |
140 | 0 | } |
141 | | |
142 | | /** |
143 | | * Remove a set of elements |
144 | | */ |
145 | | EnumSet operator-(const EnumSet aEnumSet) const |
146 | 0 | { |
147 | 0 | EnumSet result(*this); |
148 | 0 | result -= aEnumSet; |
149 | 0 | return result; |
150 | 0 | } |
151 | | |
152 | | /** |
153 | | * Clear |
154 | | */ |
155 | | void clear() |
156 | 0 | { |
157 | 0 | incVersion(); |
158 | 0 | mBitField = 0; |
159 | 0 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::clear() Unexecuted instantiation: mozilla::EnumSet<nsMencloseNotation, unsigned int>::clear() Unexecuted instantiation: mozilla::EnumSet<mozilla::LayerActivity::ActivityIndex, unsigned int>::clear() |
160 | | |
161 | | /** |
162 | | * Intersection |
163 | | */ |
164 | | void operator&=(const EnumSet aEnumSet) |
165 | 0 | { |
166 | 0 | incVersion(); |
167 | 0 | mBitField &= aEnumSet.mBitField; |
168 | 0 | } |
169 | | |
170 | | /** |
171 | | * Intersection |
172 | | */ |
173 | | EnumSet operator&(const EnumSet aEnumSet) const |
174 | | { |
175 | | EnumSet result(*this); |
176 | | result &= aEnumSet; |
177 | | return result; |
178 | | } |
179 | | |
180 | | /** |
181 | | * Equality |
182 | | */ |
183 | | bool operator==(const EnumSet aEnumSet) const |
184 | 0 | { |
185 | 0 | return mBitField == aEnumSet.mBitField; |
186 | 0 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>::operator==(mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>) const Unexecuted instantiation: mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char>::operator==(mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char>) const |
187 | | |
188 | | /** |
189 | | * Test is an element is contained in the set. |
190 | | */ |
191 | | bool contains(T aEnum) const |
192 | 9.21k | { |
193 | 9.21k | return mBitField & bitFor(aEnum); |
194 | 9.21k | } Unexecuted instantiation: mozilla::EnumSet<mozilla::VMFlag, unsigned int>::contains(mozilla::VMFlag) const Unexecuted instantiation: mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>::contains(mozilla::loader::ProcessType) const Unexecuted instantiation: mozilla::EnumSet<mozilla::layers::ScrollDirection, unsigned int>::contains(mozilla::layers::ScrollDirection) const Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::contains(mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED) const Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::contains(mozilla::TrackInfo::TrackType) const Unexecuted instantiation: mozilla::EnumSet<mozilla::CreateDecoderParams::Option, unsigned int>::contains(mozilla::CreateDecoderParams::Option) const Unexecuted instantiation: mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char>::contains(mozilla::AccessibleCaretManager::UpdateCaretsHint) const Unexecuted instantiation: mozilla::EnumSet<nsMencloseNotation, unsigned int>::contains(nsMencloseNotation) const Unexecuted instantiation: mozilla::EnumSet<mozilla::LayerActivity::ActivityIndex, unsigned int>::contains(mozilla::LayerActivity::ActivityIndex) const Unexecuted instantiation: mozilla::EnumSet<mozilla::ct::VerifiedSCT::Origin, unsigned int>::contains(mozilla::ct::VerifiedSCT::Origin) const mozilla::EnumSet<js::gc::AllocKind, unsigned int>::contains(js::gc::AllocKind) const Line | Count | Source | 192 | 9.21k | { | 193 | 9.21k | return mBitField & bitFor(aEnum); | 194 | 9.21k | } |
|
195 | | |
196 | | /** |
197 | | * Return the number of elements in the set. |
198 | | */ |
199 | | uint8_t size() const |
200 | | { |
201 | | uint8_t count = 0; |
202 | | for (Serialized bitField = mBitField; bitField; bitField >>= 1) { |
203 | | if (bitField & 1) { |
204 | | count++; |
205 | | } |
206 | | } |
207 | | return count; |
208 | | } |
209 | | |
210 | | bool isEmpty() const |
211 | 0 | { |
212 | 0 | return mBitField == 0; |
213 | 0 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>::isEmpty() const Unexecuted instantiation: mozilla::EnumSet<mozilla::layers::ScrollDirection, unsigned int>::isEmpty() const Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::isEmpty() const |
214 | | |
215 | | Serialized serialize() const |
216 | 0 | { |
217 | 0 | return mBitField; |
218 | 0 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::VMFlag, unsigned int>::serialize() const Unexecuted instantiation: mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>::serialize() const |
219 | | |
220 | | void deserialize(Serialized aValue) |
221 | 0 | { |
222 | 0 | incVersion(); |
223 | 0 | mBitField = aValue; |
224 | 0 | } |
225 | | |
226 | | class ConstIterator |
227 | | { |
228 | | const EnumSet* mSet; |
229 | | uint32_t mPos; |
230 | | #ifdef DEBUG |
231 | | uint64_t mVersion; |
232 | | #endif |
233 | | |
234 | 4.28k | void checkVersion() const { |
235 | 4.28k | // Check that the set has not been modified while being iterated. |
236 | 4.28k | MOZ_ASSERT_IF(mSet, mSet->mVersion == mVersion); |
237 | 4.28k | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::ConstIterator::checkVersion() const mozilla::EnumSet<js::gc::AllocKind, unsigned int>::ConstIterator::checkVersion() const Line | Count | Source | 234 | 4.28k | void checkVersion() const { | 235 | 4.28k | // Check that the set has not been modified while being iterated. | 236 | 4.28k | MOZ_ASSERT_IF(mSet, mSet->mVersion == mVersion); | 237 | 4.28k | } |
|
238 | | |
239 | | public: |
240 | | ConstIterator(const EnumSet& aSet, uint32_t aPos) |
241 | | : mSet(&aSet), mPos(aPos) |
242 | 576 | { |
243 | | #ifdef DEBUG |
244 | | mVersion = mSet->mVersion; |
245 | | #endif |
246 | 576 | MOZ_ASSERT(aPos <= kMaxBits); |
247 | 576 | if (aPos != kMaxBits && !mSet->contains(T(mPos))) |
248 | 252 | ++*this; |
249 | 576 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::ConstIterator::ConstIterator(mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int> const&, unsigned int) mozilla::EnumSet<js::gc::AllocKind, unsigned int>::ConstIterator::ConstIterator(mozilla::EnumSet<js::gc::AllocKind, unsigned int> const&, unsigned int) Line | Count | Source | 242 | 576 | { | 243 | | #ifdef DEBUG | 244 | | mVersion = mSet->mVersion; | 245 | | #endif | 246 | 576 | MOZ_ASSERT(aPos <= kMaxBits); | 247 | 576 | if (aPos != kMaxBits && !mSet->contains(T(mPos))) | 248 | 252 | ++*this; | 249 | 576 | } |
|
250 | | |
251 | | ConstIterator(const ConstIterator& aOther) |
252 | | : mSet(aOther.mSet), mPos(aOther.mPos) |
253 | | { |
254 | | #ifdef DEBUG |
255 | | mVersion = aOther.mVersion; |
256 | | checkVersion(); |
257 | | #endif |
258 | | } |
259 | | |
260 | | ConstIterator(ConstIterator&& aOther) |
261 | | : mSet(aOther.mSet), mPos(aOther.mPos) |
262 | | { |
263 | | #ifdef DEBUG |
264 | | mVersion = aOther.mVersion; |
265 | | checkVersion(); |
266 | | #endif |
267 | | aOther.mSet = nullptr; |
268 | | } |
269 | | |
270 | 576 | ~ConstIterator() { |
271 | 576 | checkVersion(); |
272 | 576 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::ConstIterator::~ConstIterator() mozilla::EnumSet<js::gc::AllocKind, unsigned int>::ConstIterator::~ConstIterator() Line | Count | Source | 270 | 576 | ~ConstIterator() { | 271 | 576 | checkVersion(); | 272 | 576 | } |
|
273 | | |
274 | 1.36k | bool operator==(const ConstIterator& other) const { |
275 | 1.36k | MOZ_ASSERT(mSet == other.mSet); |
276 | 1.36k | checkVersion(); |
277 | 1.36k | return mPos == other.mPos; |
278 | 1.36k | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::ConstIterator::operator==(mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::ConstIterator const&) const mozilla::EnumSet<js::gc::AllocKind, unsigned int>::ConstIterator::operator==(mozilla::EnumSet<js::gc::AllocKind, unsigned int>::ConstIterator const&) const Line | Count | Source | 274 | 1.36k | bool operator==(const ConstIterator& other) const { | 275 | 1.36k | MOZ_ASSERT(mSet == other.mSet); | 276 | 1.36k | checkVersion(); | 277 | 1.36k | return mPos == other.mPos; | 278 | 1.36k | } |
|
279 | | |
280 | 1.15k | bool operator!=(const ConstIterator& other) const { |
281 | 1.15k | return !(*this == other); |
282 | 1.15k | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::ConstIterator::operator!=(mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::ConstIterator const&) const mozilla::EnumSet<js::gc::AllocKind, unsigned int>::ConstIterator::operator!=(mozilla::EnumSet<js::gc::AllocKind, unsigned int>::ConstIterator const&) const Line | Count | Source | 280 | 1.15k | bool operator!=(const ConstIterator& other) const { | 281 | 1.15k | return !(*this == other); | 282 | 1.15k | } |
|
283 | | |
284 | 1.04k | T operator*() const { |
285 | 1.04k | MOZ_ASSERT(mSet); |
286 | 1.04k | MOZ_ASSERT(mPos < kMaxBits); |
287 | 1.04k | MOZ_ASSERT(mSet->contains(T(mPos))); |
288 | 1.04k | checkVersion(); |
289 | 1.04k | return T(mPos); |
290 | 1.04k | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::ConstIterator::operator*() const mozilla::EnumSet<js::gc::AllocKind, unsigned int>::ConstIterator::operator*() const Line | Count | Source | 284 | 1.04k | T operator*() const { | 285 | 1.04k | MOZ_ASSERT(mSet); | 286 | 1.04k | MOZ_ASSERT(mPos < kMaxBits); | 287 | 1.04k | MOZ_ASSERT(mSet->contains(T(mPos))); | 288 | 1.04k | checkVersion(); | 289 | 1.04k | return T(mPos); | 290 | 1.04k | } |
|
291 | | |
292 | 1.29k | ConstIterator& operator++() { |
293 | 1.29k | MOZ_ASSERT(mSet); |
294 | 1.29k | MOZ_ASSERT(mPos < kMaxBits); |
295 | 1.29k | checkVersion(); |
296 | 9.21k | do { |
297 | 9.21k | mPos++; |
298 | 9.21k | } while (mPos < kMaxBits && !mSet->contains(T(mPos))); |
299 | 1.29k | return *this; |
300 | 1.29k | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::ConstIterator::operator++() mozilla::EnumSet<js::gc::AllocKind, unsigned int>::ConstIterator::operator++() Line | Count | Source | 292 | 1.29k | ConstIterator& operator++() { | 293 | 1.29k | MOZ_ASSERT(mSet); | 294 | 1.29k | MOZ_ASSERT(mPos < kMaxBits); | 295 | 1.29k | checkVersion(); | 296 | 9.21k | do { | 297 | 9.21k | mPos++; | 298 | 9.21k | } while (mPos < kMaxBits && !mSet->contains(T(mPos))); | 299 | 1.29k | return *this; | 300 | 1.29k | } |
|
301 | | }; |
302 | | |
303 | 288 | ConstIterator begin() const { |
304 | 288 | return ConstIterator(*this, 0); |
305 | 288 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::begin() const mozilla::EnumSet<js::gc::AllocKind, unsigned int>::begin() const Line | Count | Source | 303 | 288 | ConstIterator begin() const { | 304 | 288 | return ConstIterator(*this, 0); | 305 | 288 | } |
|
306 | | |
307 | 288 | ConstIterator end() const { |
308 | 288 | return ConstIterator(*this, kMaxBits); |
309 | 288 | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::end() const mozilla::EnumSet<js::gc::AllocKind, unsigned int>::end() const Line | Count | Source | 307 | 288 | ConstIterator end() const { | 308 | 288 | return ConstIterator(*this, kMaxBits); | 309 | 288 | } |
|
310 | | |
311 | | private: |
312 | | static Serialized bitFor(T aEnum) |
313 | 9.37k | { |
314 | 9.37k | auto bitNumber = static_cast<Serialized>(aEnum); |
315 | 9.37k | MOZ_DIAGNOSTIC_ASSERT(bitNumber < kMaxBits); |
316 | 9.37k | return Serialized(1) << bitNumber; |
317 | 9.37k | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::bitFor(mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED) Unexecuted instantiation: mozilla::EnumSet<mozilla::MemoryMapping::Perm, unsigned char>::bitFor(mozilla::MemoryMapping::Perm) Unexecuted instantiation: mozilla::EnumSet<mozilla::VMFlag, unsigned int>::bitFor(mozilla::VMFlag) Unexecuted instantiation: mozilla::EnumSet<mozilla::CreateDecoderParams::Option, unsigned int>::bitFor(mozilla::CreateDecoderParams::Option) mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>::bitFor(mozilla::loader::ProcessType) Line | Count | Source | 313 | 5 | { | 314 | 5 | auto bitNumber = static_cast<Serialized>(aEnum); | 315 | 5 | MOZ_DIAGNOSTIC_ASSERT(bitNumber < kMaxBits); | 316 | 5 | return Serialized(1) << bitNumber; | 317 | 5 | } |
Unexecuted instantiation: mozilla::EnumSet<mozilla::layers::ScrollDirection, unsigned int>::bitFor(mozilla::layers::ScrollDirection) Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::bitFor(mozilla::TrackInfo::TrackType) Unexecuted instantiation: mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char>::bitFor(mozilla::AccessibleCaretManager::UpdateCaretsHint) Unexecuted instantiation: mozilla::EnumSet<nsMencloseNotation, unsigned int>::bitFor(nsMencloseNotation) Unexecuted instantiation: mozilla::EnumSet<mozilla::LayerActivity::ActivityIndex, unsigned int>::bitFor(mozilla::LayerActivity::ActivityIndex) Unexecuted instantiation: mozilla::EnumSet<mozilla::ct::VerifiedSCT::Origin, unsigned int>::bitFor(mozilla::ct::VerifiedSCT::Origin) mozilla::EnumSet<js::gc::AllocKind, unsigned int>::bitFor(js::gc::AllocKind) Line | Count | Source | 313 | 9.37k | { | 314 | 9.37k | auto bitNumber = static_cast<Serialized>(aEnum); | 315 | 9.37k | MOZ_DIAGNOSTIC_ASSERT(bitNumber < kMaxBits); | 316 | 9.37k | return Serialized(1) << bitNumber; | 317 | 9.37k | } |
|
318 | | |
319 | 161 | void incVersion() { |
320 | | #ifdef DEBUG |
321 | | mVersion++; |
322 | | #endif |
323 | | } Unexecuted instantiation: mozilla::EnumSet<mozilla::Telemetry::LABELS_DOCUMENT_ANALYTICS_TRACKER_FASTBLOCKED, unsigned int>::incVersion() Unexecuted instantiation: mozilla::EnumSet<mozilla::MemoryMapping::Perm, unsigned char>::incVersion() Unexecuted instantiation: mozilla::EnumSet<mozilla::VMFlag, unsigned int>::incVersion() mozilla::EnumSet<mozilla::loader::ProcessType, unsigned char>::incVersion() Line | Count | Source | 319 | 5 | void incVersion() { | 320 | | #ifdef DEBUG | 321 | | mVersion++; | 322 | | #endif | 323 | | } |
Unexecuted instantiation: mozilla::EnumSet<mozilla::layers::ScrollDirection, unsigned int>::incVersion() Unexecuted instantiation: mozilla::EnumSet<mozilla::TrackInfo::TrackType, unsigned int>::incVersion() Unexecuted instantiation: mozilla::EnumSet<mozilla::AccessibleCaretManager::UpdateCaretsHint, unsigned char>::incVersion() Unexecuted instantiation: mozilla::EnumSet<nsMencloseNotation, unsigned int>::incVersion() Unexecuted instantiation: mozilla::EnumSet<mozilla::LayerActivity::ActivityIndex, unsigned int>::incVersion() Unexecuted instantiation: mozilla::EnumSet<mozilla::ct::VerifiedSCT::Origin, unsigned int>::incVersion() mozilla::EnumSet<js::gc::AllocKind, unsigned int>::incVersion() Line | Count | Source | 319 | 156 | void incVersion() { | 320 | | #ifdef DEBUG | 321 | | mVersion++; | 322 | | #endif | 323 | | } |
|
324 | | |
325 | | static const size_t kMaxBits = sizeof(Serialized) * 8; |
326 | | |
327 | | Serialized mBitField; |
328 | | |
329 | | #ifdef DEBUG |
330 | | uint64_t mVersion = 0; |
331 | | #endif |
332 | | }; |
333 | | |
334 | | } // namespace mozilla |
335 | | |
336 | | #endif /* mozilla_EnumSet_h_*/ |