summaryrefslogtreecommitdiff
path: root/js/src/ds/OrderedHashTable.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/ds/OrderedHashTable.h')
-rw-r--r--js/src/ds/OrderedHashTable.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/js/src/ds/OrderedHashTable.h b/js/src/ds/OrderedHashTable.h
index c12d43caa7..1432b308fb 100644
--- a/js/src/ds/OrderedHashTable.h
+++ b/js/src/ds/OrderedHashTable.h
@@ -86,7 +86,7 @@ class OrderedHashTable
OrderedHashTable(AllocPolicy& ap, mozilla::HashCodeScrambler hcs)
: hashTable(nullptr), data(nullptr), dataLength(0), ranges(nullptr), alloc(ap), hcs(hcs) {}
- MOZ_MUST_USE bool init() {
+ [[nodiscard]] bool init() {
MOZ_ASSERT(!hashTable, "init must be called at most once");
uint32_t buckets = initialBuckets();
@@ -153,7 +153,7 @@ class OrderedHashTable
* means the element was not added to the table.
*/
template <typename ElementInput>
- MOZ_MUST_USE bool put(ElementInput&& element) {
+ [[nodiscard]] bool put(ElementInput&& element) {
HashNumber h = prepareHash(Ops::getKey(element));
if (Data* e = lookup(Ops::getKey(element), h)) {
e->element = Forward<ElementInput>(element);
@@ -224,7 +224,7 @@ class OrderedHashTable
* particular, those Ranges are still live and will see any entries added
* after a successful clear().
*/
- MOZ_MUST_USE bool clear() {
+ [[nodiscard]] bool clear() {
if (dataLength != 0) {
Data** oldHashTable = hashTable;
Data* oldData = data;
@@ -633,7 +633,7 @@ class OrderedHashTable
* empty elements in data[0:dataLength]. On allocation failure, this
* leaves everything as it was and returns false.
*/
- MOZ_MUST_USE bool rehash(uint32_t newHashShift) {
+ [[nodiscard]] bool rehash(uint32_t newHashShift) {
// If the size of the table is not changing, rehash in place to avoid
// allocating memory.
if (newHashShift == hashShift) {
@@ -746,17 +746,17 @@ class OrderedHashMap
typedef typename Impl::Range Range;
OrderedHashMap(AllocPolicy ap, mozilla::HashCodeScrambler hcs) : impl(ap, hcs) {}
- MOZ_MUST_USE bool init() { return impl.init(); }
+ [[nodiscard]] bool init() { return impl.init(); }
uint32_t count() const { return impl.count(); }
bool has(const Key& key) const { return impl.has(key); }
Range all() { return impl.all(); }
const Entry* get(const Key& key) const { return impl.get(key); }
Entry* get(const Key& key) { return impl.get(key); }
bool remove(const Key& key, bool* foundp) { return impl.remove(key, foundp); }
- MOZ_MUST_USE bool clear() { return impl.clear(); }
+ [[nodiscard]] bool clear() { return impl.clear(); }
template <typename V>
- MOZ_MUST_USE bool put(const Key& key, V&& value) {
+ [[nodiscard]] bool put(const Key& key, V&& value) {
return impl.put(Entry(key, Forward<V>(value)));
}
@@ -804,13 +804,13 @@ class OrderedHashSet
typedef typename Impl::Range Range;
explicit OrderedHashSet(AllocPolicy ap, mozilla::HashCodeScrambler hcs) : impl(ap, hcs) {}
- MOZ_MUST_USE bool init() { return impl.init(); }
+ [[nodiscard]] bool init() { return impl.init(); }
uint32_t count() const { return impl.count(); }
bool has(const T& value) const { return impl.has(value); }
Range all() { return impl.all(); }
- MOZ_MUST_USE bool put(const T& value) { return impl.put(value); }
+ [[nodiscard]] bool put(const T& value) { return impl.put(value); }
bool remove(const T& value, bool* foundp) { return impl.remove(value, foundp); }
- MOZ_MUST_USE bool clear() { return impl.clear(); }
+ [[nodiscard]] bool clear() { return impl.clear(); }
HashNumber hash(const T& value) const { return impl.prepareHash(value); }