diff options
author | Gil <mcg@google.com> | 2018-04-12 14:54:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-12 14:54:53 -0700 |
commit | 8876622b6fcebc21672bc263666b858b7e152b45 (patch) | |
tree | 053fe00a20207099c11c1464df25565a5f5cc3c6 /Firestore/core/src/firebase/firestore/util | |
parent | 1397e4ae72ea3b8d16a9b44ed1235caca47b3d9e (diff) |
Add clang-tidy checks for Firestore (#1078)
* Add a .clang-tidy configuration for Firestore C++
* Fix clang-tidy warnings
* typedef -> using
* const ref + rvalue ref -> pass by value
* NULL -> nullptr
* remove useless default initializations
* remove useless const value-type parameter declarations (definitions
can still use them)
* use auto instead of repeating types in a cast
* Fix typos
* Address use of static method through instance warnings
* Address use after move warnings
Diffstat (limited to 'Firestore/core/src/firebase/firestore/util')
3 files changed, 8 insertions, 8 deletions
diff --git a/Firestore/core/src/firebase/firestore/util/bits.h b/Firestore/core/src/firebase/firestore/util/bits.h index fec1228..94a018f 100644 --- a/Firestore/core/src/firebase/firestore/util/bits.h +++ b/Firestore/core/src/firebase/firestore/util/bits.h @@ -139,23 +139,23 @@ inline int Bits::Log2FloorNonZero_Portable(uint32_t n) { // Log2Floor64() is defined in terms of Log2Floor32(), Log2FloorNonZero32() inline int Bits::Log2Floor64_Portable(uint64_t n) { - const uint32_t topbits = static_cast<uint32_t>(n >> 32); - if (topbits == 0) { + const auto top_bits = static_cast<uint32_t>(n >> 32); + if (top_bits == 0) { // Top bits are zero, so scan in bottom bits return Log2Floor(static_cast<uint32_t>(n)); } else { - return 32 + Log2FloorNonZero(topbits); + return 32 + Log2FloorNonZero(top_bits); } } // Log2FloorNonZero64() is defined in terms of Log2FloorNonZero32() inline int Bits::Log2FloorNonZero64_Portable(uint64_t n) { - const uint32_t topbits = static_cast<uint32_t>(n >> 32); - if (topbits == 0) { + const auto top_bits = static_cast<uint32_t>(n >> 32); + if (top_bits == 0) { // Top bits are zero, so scan in bottom bits return Log2FloorNonZero(static_cast<uint32_t>(n)); } else { - return 32 + Log2FloorNonZero(topbits); + return 32 + Log2FloorNonZero(top_bits); } } diff --git a/Firestore/core/src/firebase/firestore/util/comparator_holder.h b/Firestore/core/src/firebase/firestore/util/comparator_holder.h index 8641b0f..c7f6144 100644 --- a/Firestore/core/src/firebase/firestore/util/comparator_holder.h +++ b/Firestore/core/src/firebase/firestore/util/comparator_holder.h @@ -47,7 +47,7 @@ class ComparatorHolder { template <typename C> class ComparatorHolder<C, true> : private C { protected: - explicit ComparatorHolder(const C&) noexcept { + explicit ComparatorHolder(const C& /* comparator */) noexcept { } const C& comparator() const noexcept { diff --git a/Firestore/core/src/firebase/firestore/util/comparison.cc b/Firestore/core/src/firebase/firestore/util/comparison.cc index b346277..5ac4c27 100644 --- a/Firestore/core/src/firebase/firestore/util/comparison.cc +++ b/Firestore/core/src/firebase/firestore/util/comparison.cc @@ -78,7 +78,7 @@ ComparisonResult CompareMixedNumber(double double_value, int64_t int64_value) { // At this point the long representations are equal but this could be due to // rounding. - double int64_as_double = static_cast<double>(int64_value); + auto int64_as_double = static_cast<double>(int64_value); return Compare<double>(double_value, int64_as_double); } |