From 8876622b6fcebc21672bc263666b858b7e152b45 Mon Sep 17 00:00:00 2001 From: Gil Date: Thu, 12 Apr 2018 14:54:53 -0700 Subject: 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 --- Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h | 6 ++---- Firestore/core/src/firebase/firestore/immutable/map_entry.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'Firestore/core/src/firebase/firestore/immutable') 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 56da9e9..92fd823 100644 --- a/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h +++ b/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h @@ -70,8 +70,8 @@ class FixedArray { */ template void append(SourceIterator src_begin, SourceIterator src_end) { - size_type appending = static_cast(src_end - src_begin); - size_type new_size = size_ + appending; + auto appending = static_cast(src_end - src_begin); + auto new_size = size_ + appending; FIREBASE_ASSERT(new_size <= fixed_size); std::copy(src_begin, src_end, end()); @@ -229,8 +229,6 @@ class ArraySortedMap : public SortedMapBase { } } - // TODO(wilhuff): indexof - /** Returns true if the map contains no elements. */ bool empty() const { return size() == 0; diff --git a/Firestore/core/src/firebase/firestore/immutable/map_entry.h b/Firestore/core/src/firebase/firestore/immutable/map_entry.h index 2130b5b..1022b06 100644 --- a/Firestore/core/src/firebase/firestore/immutable/map_entry.h +++ b/Firestore/core/src/firebase/firestore/immutable/map_entry.h @@ -33,7 +33,7 @@ namespace immutable { */ template > struct KeyComparator { - typedef std::pair pair_type; + using pair_type = std::pair; explicit KeyComparator(const C& comparator = C()) : key_comparator_(comparator) { -- cgit v1.2.3