diff options
Diffstat (limited to 'js/public/HashTable.h')
-rw-r--r-- | js/public/HashTable.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/js/public/HashTable.h b/js/public/HashTable.h index d0f7dba41f..ab04a2c7b1 100644 --- a/js/public/HashTable.h +++ b/js/public/HashTable.h @@ -88,7 +88,7 @@ class HashMap // HashMap construction is fallible (due to OOM); thus the user must call // init after constructing a HashMap and check the return value. explicit HashMap(AllocPolicy a = AllocPolicy()) : impl(a) {} - MOZ_MUST_USE bool init(uint32_t len = 16) { return impl.init(len); } + [[nodiscard]] bool init(uint32_t len = 16) { return impl.init(len); } bool initialized() const { return impl.initialized(); } // Return whether the given lookup value is present in the map. E.g.: @@ -151,19 +151,19 @@ class HashMap } template<typename KeyInput, typename ValueInput> - MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& k, ValueInput&& v) { + [[nodiscard]] bool add(AddPtr& p, KeyInput&& k, ValueInput&& v) { return impl.add(p, mozilla::Forward<KeyInput>(k), mozilla::Forward<ValueInput>(v)); } template<typename KeyInput> - MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& k) { + [[nodiscard]] bool add(AddPtr& p, KeyInput&& k) { return impl.add(p, mozilla::Forward<KeyInput>(k), Value()); } template<typename KeyInput, typename ValueInput> - MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, KeyInput&& k, ValueInput&& v) { + [[nodiscard]] bool relookupOrAdd(AddPtr& p, KeyInput&& k, ValueInput&& v) { return impl.relookupOrAdd(p, k, mozilla::Forward<KeyInput>(k), mozilla::Forward<ValueInput>(v)); @@ -232,7 +232,7 @@ class HashMap // Overwrite existing value with v. Return false on oom. template<typename KeyInput, typename ValueInput> - MOZ_MUST_USE bool put(KeyInput&& k, ValueInput&& v) { + [[nodiscard]] bool put(KeyInput&& k, ValueInput&& v) { AddPtr p = lookupForAdd(k); if (p) { p->value() = mozilla::Forward<ValueInput>(v); @@ -243,7 +243,7 @@ class HashMap // Like put, but assert that the given key is not already present. template<typename KeyInput, typename ValueInput> - MOZ_MUST_USE bool putNew(KeyInput&& k, ValueInput&& v) { + [[nodiscard]] bool putNew(KeyInput&& k, ValueInput&& v) { return impl.putNew(k, mozilla::Forward<KeyInput>(k), mozilla::Forward<ValueInput>(v)); } @@ -341,7 +341,7 @@ class HashSet // HashSet construction is fallible (due to OOM); thus the user must call // init after constructing a HashSet and check the return value. explicit HashSet(AllocPolicy a = AllocPolicy()) : impl(a) {} - MOZ_MUST_USE bool init(uint32_t len = 16) { return impl.init(len); } + [[nodiscard]] bool init(uint32_t len = 16) { return impl.init(len); } bool initialized() const { return impl.initialized(); } // Return whether the given lookup value is present in the map. E.g.: @@ -399,12 +399,12 @@ class HashSet AddPtr lookupForAdd(const Lookup& l) const { return impl.lookupForAdd(l); } template <typename U> - MOZ_MUST_USE bool add(AddPtr& p, U&& u) { + [[nodiscard]] bool add(AddPtr& p, U&& u) { return impl.add(p, mozilla::Forward<U>(u)); } template <typename U> - MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) { + [[nodiscard]] bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) { return impl.relookupOrAdd(p, l, mozilla::Forward<U>(u)); } @@ -471,19 +471,19 @@ class HashSet // Add |u| if it is not present already. Return false on oom. template <typename U> - MOZ_MUST_USE bool put(U&& u) { + [[nodiscard]] bool put(U&& u) { AddPtr p = lookupForAdd(u); return p ? true : add(p, mozilla::Forward<U>(u)); } // Like put, but assert that the given key is not already present. template <typename U> - MOZ_MUST_USE bool putNew(U&& u) { + [[nodiscard]] bool putNew(U&& u) { return impl.putNew(u, mozilla::Forward<U>(u)); } template <typename U> - MOZ_MUST_USE bool putNew(const Lookup& l, U&& u) { + [[nodiscard]] bool putNew(const Lookup& l, U&& u) { return impl.putNew(l, mozilla::Forward<U>(u)); } @@ -1277,7 +1277,7 @@ class HashTable : private AllocPolicy #endif {} - MOZ_MUST_USE bool init(uint32_t length) + [[nodiscard]] bool init(uint32_t length) { MOZ_ASSERT(!initialized()); @@ -1775,7 +1775,7 @@ class HashTable : private AllocPolicy } template <typename... Args> - MOZ_MUST_USE bool add(AddPtr& p, Args&&... args) + [[nodiscard]] bool add(AddPtr& p, Args&&... args) { mozilla::ReentrancyGuard g(*this); MOZ_ASSERT(table); @@ -1828,7 +1828,7 @@ class HashTable : private AllocPolicy // Note: |l| may be alias arguments in |args|, so this function must take // care not to use |l| after moving |args|. template <typename... Args> - MOZ_MUST_USE bool putNew(const Lookup& l, Args&&... args) + [[nodiscard]] bool putNew(const Lookup& l, Args&&... args) { if (!this->checkSimulatedOOM()) return false; @@ -1846,7 +1846,7 @@ class HashTable : private AllocPolicy // Note: |l| may be a reference to a piece of |u|, so this function // must take care not to use |l| after moving |u|. template <typename... Args> - MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, const Lookup& l, Args&&... args) + [[nodiscard]] bool relookupOrAdd(AddPtr& p, const Lookup& l, Args&&... args) { // Check for error from ensureHash() here. if (p.isValid()) |