diff options
author | Gil <mcg@google.com> | 2018-05-22 13:21:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-22 13:21:08 -0700 |
commit | d439bbccd4b90583a89d209d2cc81308aabca8ac (patch) | |
tree | 13fb14cc905f667e1470bcc14a3c84dfb6a7a109 /Firestore/core/src/firebase/firestore/immutable | |
parent | 476be0ba2ba8340296a5b5b05f27f3ded4bd6c72 (diff) |
Add a HARD_ASSERT C++ assertion macro (#1304)
* Add HARD_ASSERT
* Use HARD_ASSERT
* Remove FIREBASE_ASSERT
* Remove StringPrintf
Diffstat (limited to 'Firestore/core/src/firebase/firestore/immutable')
5 files changed, 22 insertions, 22 deletions
diff --git a/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h b/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h index db53969..b1c9398 100644 --- a/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h +++ b/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h @@ -28,7 +28,7 @@ #include "Firestore/core/src/firebase/firestore/immutable/map_entry.h" #include "Firestore/core/src/firebase/firestore/immutable/sorted_map_base.h" #include "Firestore/core/src/firebase/firestore/util/comparison.h" -#include "Firestore/core/src/firebase/firestore/util/firebase_assert.h" +#include "Firestore/core/src/firebase/firestore/util/hard_assert.h" #include "Firestore/core/src/firebase/firestore/util/range.h" namespace firebase { @@ -74,7 +74,7 @@ class FixedArray { void append(SourceIterator src_begin, SourceIterator src_end) { auto appending = static_cast<size_type>(src_end - src_begin); auto new_size = size_ + appending; - FIREBASE_ASSERT(new_size <= SortedMapBase::kFixedSize); + HARD_ASSERT(new_size <= SortedMapBase::kFixedSize); std::copy(src_begin, src_end, end()); size_ = new_size; @@ -85,7 +85,7 @@ class FixedArray { */ void append(T&& value) { size_type new_size = size_ + 1; - FIREBASE_ASSERT(new_size <= SortedMapBase::kFixedSize); + HARD_ASSERT(new_size <= SortedMapBase::kFixedSize); *end() = std::move(value); size_ = new_size; diff --git a/Firestore/core/src/firebase/firestore/immutable/llrb_node_iterator.h b/Firestore/core/src/firebase/firestore/immutable/llrb_node_iterator.h index 5011947..3092678 100644 --- a/Firestore/core/src/firebase/firestore/immutable/llrb_node_iterator.h +++ b/Firestore/core/src/firebase/firestore/immutable/llrb_node_iterator.h @@ -23,7 +23,7 @@ #include "Firestore/core/src/firebase/firestore/immutable/llrb_node.h" #include "Firestore/core/src/firebase/firestore/util/comparison.h" -#include "Firestore/core/src/firebase/firestore/util/firebase_assert.h" +#include "Firestore/core/src/firebase/firestore/util/hard_assert.h" namespace firebase { namespace firestore { @@ -149,7 +149,7 @@ class LlrbNodeIterator { * This can only be called if `end()` is false. */ pointer get() const { - FIREBASE_ASSERT(!is_end()); + HARD_ASSERT(!is_end()); return &(stack_.top()->entry()); } @@ -162,7 +162,7 @@ class LlrbNodeIterator { } LlrbNodeIterator& operator++() { - FIREBASE_ASSERT(!is_end()); + HARD_ASSERT(!is_end()); // Pop the stack, moving the currently pointed to node to the parent. const node_type* node = stack_.top(); diff --git a/Firestore/core/src/firebase/firestore/immutable/sorted_map.h b/Firestore/core/src/firebase/firestore/immutable/sorted_map.h index 647bab0..3a50020 100644 --- a/Firestore/core/src/firebase/firestore/immutable/sorted_map.h +++ b/Firestore/core/src/firebase/firestore/immutable/sorted_map.h @@ -144,7 +144,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return tree_.empty(); } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } /** Returns the number of items in this map. */ @@ -155,7 +155,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return tree_.size(); } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } /** @@ -184,7 +184,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return SortedMap{tree_.insert(key, value)}; } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } /** @@ -205,7 +205,7 @@ class SortedMap : public impl::SortedMapBase { } return SortedMap{std::move(result)}; } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } bool contains(const K& key) const { @@ -215,7 +215,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return tree_.contains(key); } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } /** @@ -232,7 +232,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return const_iterator{tree_.find(key)}; } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } /** @@ -248,7 +248,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return tree_.find_index(key); } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } /** @@ -267,7 +267,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return const_iterator{tree_.lower_bound(key)}; } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } const_iterator min() const { @@ -277,7 +277,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return const_iterator{tree_.min()}; } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } const_iterator max() const { @@ -287,7 +287,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return const_iterator{tree_.max()}; } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } /** @@ -301,7 +301,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return const_iterator{tree_.begin()}; } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } /** @@ -314,7 +314,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return const_iterator{tree_.end()}; } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } /** @@ -359,7 +359,7 @@ class SortedMap : public impl::SortedMapBase { case Tag::Tree: return tree_.comparator(); } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } enum class Tag { diff --git a/Firestore/core/src/firebase/firestore/immutable/sorted_map_iterator.h b/Firestore/core/src/firebase/firestore/immutable/sorted_map_iterator.h index a79f9f5..960e3f6 100644 --- a/Firestore/core/src/firebase/firestore/immutable/sorted_map_iterator.h +++ b/Firestore/core/src/firebase/firestore/immutable/sorted_map_iterator.h @@ -123,7 +123,7 @@ class SortedMapIterator { case Tag::Tree: return tree_iter_.get(); } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } reference operator*() const { @@ -164,7 +164,7 @@ class SortedMapIterator { case Tag::Tree: return a.tree_iter_ == b.tree_iter_; } - FIREBASE_UNREACHABLE(); + UNREACHABLE(); } bool operator!=(const SortedMapIterator& b) const { diff --git a/Firestore/core/src/firebase/firestore/immutable/sorted_set.h b/Firestore/core/src/firebase/firestore/immutable/sorted_set.h index d78fd61..1fe91bd 100644 --- a/Firestore/core/src/firebase/firestore/immutable/sorted_set.h +++ b/Firestore/core/src/firebase/firestore/immutable/sorted_set.h @@ -23,7 +23,7 @@ #include "Firestore/core/src/firebase/firestore/immutable/sorted_map.h" #include "Firestore/core/src/firebase/firestore/immutable/sorted_map_base.h" #include "Firestore/core/src/firebase/firestore/util/comparison.h" -#include "Firestore/core/src/firebase/firestore/util/firebase_assert.h" +#include "Firestore/core/src/firebase/firestore/util/hard_assert.h" #include "Firestore/core/src/firebase/firestore/util/hashing.h" namespace firebase { |