From: Yedidya Feldblum Date: Sun, 30 Jul 2017 03:09:05 +0000 (-0700) Subject: Consistent indentation for class visibility labels X-Git-Tag: v2017.07.31.00~5 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=83b9f93f4f5b536792b36de0e6d601e2a3b894bc;p=folly.git Consistent indentation for class visibility labels Summary: [Folly] Consistent indentation for class visibility labels (`public:`, `protected:`, `private:`). Style is +1 column relative to the `class` keyword. Reviewed By: andrewjcg Differential Revision: D5524869 fbshipit-source-id: 53e4b6cbda10d5b63bafbd535794a8b7ae01a8e0 --- diff --git a/folly/AtomicHashArray.h b/folly/AtomicHashArray.h index 7dce3a0e..3e151afc 100644 --- a/folly/AtomicHashArray.h +++ b/folly/AtomicHashArray.h @@ -179,7 +179,6 @@ class AtomicHashArray : boost::noncopyable { uint32_t entryCountThreadCacheSize; size_t capacity; // if positive, overrides maxLoadFactor - public: // Cannot have constexpr ctor because some compilers rightly complain. Config() : emptyKey((KeyT)-1), lockedKey((KeyT)-2), diff --git a/folly/FBString.h b/folly/FBString.h index b36bb948..a22dee19 100644 --- a/folly/FBString.h +++ b/folly/FBString.h @@ -231,7 +231,7 @@ enum class AcquireMallocatedString {}; template class fbstring_core_model { -public: + public: fbstring_core_model(); fbstring_core_model(const fbstring_core_model &); ~fbstring_core_model(); @@ -280,7 +280,7 @@ public: // the string without reallocation. For reference-counted strings, // it should fork the data even if minCapacity < size(). void reserve(size_t minCapacity); -private: + private: // Do not implement fbstring_core_model& operator=(const fbstring_core_model &); }; @@ -313,7 +313,7 @@ private: * to extract capacity/category. */ template class fbstring_core { -protected: + protected: // It's MSVC, so we just have to guess ... and allow an override #ifdef _MSC_VER # ifdef FOLLY_ENDIAN_BE @@ -325,7 +325,7 @@ protected: static constexpr auto kIsLittleEndian = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__; #endif -public: + public: fbstring_core() noexcept { reset(); } fbstring_core(const fbstring_core & rhs) { @@ -512,7 +512,7 @@ public: return category() == Category::isLarge && RefCounted::refs(ml_.data_) > 1; } -private: + private: // Disabled fbstring_core & operator=(const fbstring_core & rhs); @@ -989,7 +989,7 @@ inline void fbstring_core::shrinkLarge(const size_t delta) { */ template class dummy_fbstring_core { -public: + public: dummy_fbstring_core() { } dummy_fbstring_core(const dummy_fbstring_core& another) @@ -1032,7 +1032,7 @@ public: backend_.reserve(minCapacity); } -private: + private: std::basic_string backend_; }; #endif // !_LIBSTDCXX_FBSTRING @@ -1113,7 +1113,7 @@ class basic_fbstring { static constexpr size_type npos = size_type(-1); typedef std::true_type IsRelocatable; -private: + private: static void procrustes(size_type& n, size_type nmax) { if (n > nmax) { n = nmax; @@ -1122,7 +1122,7 @@ private: static size_type traitsLength(const value_type* s); -public: + public: // C++11 21.4.2 construct/copy/destroy // Note: while the following two constructors can be (and previously were) @@ -1495,29 +1495,29 @@ public: } #endif -private: - iterator - insertImplDiscr(const_iterator i, size_type n, value_type c, std::true_type); - - template - iterator - insertImplDiscr(const_iterator i, InputIter b, InputIter e, std::false_type); - - template - iterator insertImpl( - const_iterator i, - FwdIterator s1, - FwdIterator s2, - std::forward_iterator_tag); - - template - iterator insertImpl( - const_iterator i, - InputIterator b, - InputIterator e, - std::input_iterator_tag); - -public: + private: + iterator + insertImplDiscr(const_iterator i, size_type n, value_type c, std::true_type); + + template + iterator + insertImplDiscr(const_iterator i, InputIter b, InputIter e, std::false_type); + + template + iterator insertImpl( + const_iterator i, + FwdIterator s1, + FwdIterator s2, + std::forward_iterator_tag); + + template + iterator insertImpl( + const_iterator i, + InputIterator b, + InputIterator e, + std::input_iterator_tag); + + public: template iterator insert(const_iterator p, ItOrLength first_or_n, ItOrChar last_or_c) { using Sel = std::integral_constant< @@ -1601,36 +1601,37 @@ public: return replace(i1, i2, s, traitsLength(s)); } -private: - basic_fbstring& replaceImplDiscr( - iterator i1, - iterator i2, - const value_type* s, - size_type n, - std::integral_constant); - - basic_fbstring& replaceImplDiscr( - iterator i1, - iterator i2, - size_type n2, - value_type c, - std::integral_constant); - - template - basic_fbstring& replaceImplDiscr( - iterator i1, - iterator i2, - InputIter b, - InputIter e, - std::integral_constant); - -private: - template - bool replaceAliased(iterator /* i1 */, - iterator /* i2 */, - FwdIterator /* s1 */, - FwdIterator /* s2 */, - std::false_type) { + private: + basic_fbstring& replaceImplDiscr( + iterator i1, + iterator i2, + const value_type* s, + size_type n, + std::integral_constant); + + basic_fbstring& replaceImplDiscr( + iterator i1, + iterator i2, + size_type n2, + value_type c, + std::integral_constant); + + template + basic_fbstring& replaceImplDiscr( + iterator i1, + iterator i2, + InputIter b, + InputIter e, + std::integral_constant); + + private: + template + bool replaceAliased( + iterator /* i1 */, + iterator /* i2 */, + FwdIterator /* s1 */, + FwdIterator /* s2 */, + std::false_type) { return false; } @@ -1842,7 +1843,7 @@ private: return r != 0 ? r : n1 > n2 ? 1 : n1 < n2 ? -1 : 0; } -private: + private: // Data Storage store_; }; diff --git a/folly/FBVector.h b/folly/FBVector.h index 4a792af0..0acac234 100644 --- a/folly/FBVector.h +++ b/folly/FBVector.h @@ -77,8 +77,7 @@ class fbvector { //=========================================================================== //--------------------------------------------------------------------------- // implementation -private: - + private: typedef std::allocator_traits A; struct Impl : public Allocator { @@ -192,8 +191,7 @@ private: //=========================================================================== //--------------------------------------------------------------------------- // types and constants -public: - + public: typedef T value_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -207,8 +205,7 @@ public: typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; -private: - + private: typedef std::integral_constant::value && sizeof(T) <= 16 // don't force large structures to be passed by value @@ -227,8 +224,7 @@ private: //=========================================================================== //--------------------------------------------------------------------------- // allocator helpers -private: - + private: //--------------------------------------------------------------------------- // allocate @@ -332,8 +328,7 @@ private: //=========================================================================== //--------------------------------------------------------------------------- // algorithmic helpers -private: - + private: //--------------------------------------------------------------------------- // destroy_range @@ -582,8 +577,7 @@ private: //=========================================================================== //--------------------------------------------------------------------------- // relocation helpers -private: - + private: // Relocation is divided into three parts: // // 1: relocate_move @@ -689,8 +683,7 @@ private: //=========================================================================== //--------------------------------------------------------------------------- // construct/copy/destroy -public: - + public: fbvector() = default; explicit fbvector(const Allocator& a) : impl_(a) {} @@ -794,8 +787,7 @@ public: return impl_; } -private: - + private: // contract dispatch for iterator types fbvector(It first, It last) template fbvector(ForwardIterator first, ForwardIterator last, @@ -868,8 +860,7 @@ private: //=========================================================================== //--------------------------------------------------------------------------- // iterators -public: - + public: iterator begin() noexcept { return impl_.b_; } @@ -911,8 +902,7 @@ public: //=========================================================================== //--------------------------------------------------------------------------- // capacity -public: - + public: size_type size() const noexcept { return size_type(impl_.e_ - impl_.b_); } @@ -1011,8 +1001,7 @@ public: } } -private: - + private: bool reserve_in_place(size_type n) { if (!usingStdAllocator::value || !usingJEMalloc()) return false; @@ -1032,8 +1021,7 @@ private: //=========================================================================== //--------------------------------------------------------------------------- // element access -public: - + public: reference operator[](size_type n) { assert(n < size()); return impl_.b_[n]; @@ -1072,8 +1060,7 @@ public: //=========================================================================== //--------------------------------------------------------------------------- // data access -public: - + public: T* data() noexcept { return impl_.b_; } @@ -1084,8 +1071,7 @@ public: //=========================================================================== //--------------------------------------------------------------------------- // modifiers (common) -public: - + public: template void emplace_back(Args&&... args) { if (impl_.e_ != impl_.z_) { @@ -1133,8 +1119,7 @@ public: M_destroy_range_e(impl_.b_); } -private: - + private: // std::vector implements a similar function with a different growth // strategy: empty() ? 1 : capacity() * 2. // @@ -1172,8 +1157,7 @@ private: //=========================================================================== //--------------------------------------------------------------------------- // modifiers (erase) -public: - + public: iterator erase(const_iterator position) { return erase(position, position + 1); } @@ -1207,8 +1191,7 @@ public: //=========================================================================== //--------------------------------------------------------------------------- // modifiers (insert) -private: // we have the private section first because it defines some macros - + private: // we have the private section first because it defines some macros bool isValid(const_iterator it) { return cbegin() <= it && it <= cend(); } @@ -1476,8 +1459,7 @@ private: // we have the private section first because it defines some macros //--------------------------------------------------------------------------- // insert dispatch for iterator types -private: - + private: template iterator insert(const_iterator cpos, FIt first, FIt last, std::forward_iterator_tag) { @@ -1511,8 +1493,7 @@ private: //=========================================================================== //--------------------------------------------------------------------------- // lexicographical functions -public: - + public: bool operator==(const fbvector& other) const { return size() == other.size() && std::equal(begin(), end(), other.begin()); } @@ -1541,8 +1522,7 @@ public: //=========================================================================== //--------------------------------------------------------------------------- // friends -private: - + private: template friend _T* relinquish(fbvector<_T, _A>&); diff --git a/folly/Foreach.h b/folly/Foreach.h index 3ea9b3a4..51372ef2 100644 --- a/folly/Foreach.h +++ b/folly/Foreach.h @@ -120,7 +120,8 @@ class HasLess { struct BiggerThanChar { char unused[2]; }; template static char test(decltype(C() < D())*); template static BiggerThanChar test(...); -public: + + public: enum { value = sizeof(test(0)) == 1 }; }; diff --git a/folly/Hash.h b/folly/Hash.h index 78bb5f48..211dc44e 100644 --- a/folly/Hash.h +++ b/folly/Hash.h @@ -505,7 +505,7 @@ namespace std { // items in the pair. template struct hash > { - public: + public: size_t operator()(const std::pair& x) const { return folly::hash::hash_combine(x.first, x.second); } diff --git a/folly/Lazy.h b/folly/Lazy.h index 963dd479..afab2faa 100644 --- a/folly/Lazy.h +++ b/folly/Lazy.h @@ -111,7 +111,7 @@ struct Lazy { return *value_; } -private: + private: Optional value_; Func func_; }; diff --git a/folly/Memory.h b/folly/Memory.h index 0ff1983f..39b868c1 100644 --- a/folly/Memory.h +++ b/folly/Memory.h @@ -317,7 +317,7 @@ class allocator_delete { typedef typename std::remove_reference::type allocator_type; -public: + public: typedef typename Allocator::pointer pointer; allocator_delete() = default; @@ -356,7 +356,7 @@ class is_simple_allocator { typedef typename std::remove_reference::type value_type; typedef value_type* pointer; -public: + public: constexpr static bool value = !has_destroy::value && !has_destroy::value; }; @@ -491,7 +491,7 @@ template struct IsArenaAllocator : std::false_type { }; */ template class enable_shared_from_this : public std::enable_shared_from_this { -public: + public: constexpr enable_shared_from_this() noexcept = default; std::weak_ptr weak_from_this() noexcept { @@ -502,7 +502,7 @@ public: return weak_from_this_(this); } -private: + private: // Uses SFINAE to detect and call // std::enable_shared_from_this::weak_from_this() if available. Falls // back to std::enable_shared_from_this::shared_from_this() otherwise. diff --git a/folly/PackedSyncPtr.h b/folly/PackedSyncPtr.h index f5f4eb9e..44d3f557 100644 --- a/folly/PackedSyncPtr.h +++ b/folly/PackedSyncPtr.h @@ -66,7 +66,7 @@ class PackedSyncPtr { // still properly result in a compile error. typedef typename std::add_lvalue_reference::type reference; -public: + public: /* * If you default construct one of these, you must call this init() * function before using it. diff --git a/folly/ProducerConsumerQueue.h b/folly/ProducerConsumerQueue.h index 13948be4..fd9c94a0 100644 --- a/folly/ProducerConsumerQueue.h +++ b/folly/ProducerConsumerQueue.h @@ -167,15 +167,15 @@ struct ProducerConsumerQueue { return ret; } -private: - char pad0_[CacheLocality::kFalseSharingRange]; - const uint32_t size_; - T* const records_; + private: + char pad0_[CacheLocality::kFalseSharingRange]; + const uint32_t size_; + T* const records_; - FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic readIndex_; - FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic writeIndex_; + FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic readIndex_; + FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic writeIndex_; - char pad1_[CacheLocality::kFalseSharingRange - sizeof(writeIndex_)]; + char pad1_[CacheLocality::kFalseSharingRange - sizeof(writeIndex_)]; }; } diff --git a/folly/Range.h b/folly/Range.h index 3ccf8685..aaf30af7 100644 --- a/folly/Range.h +++ b/folly/Range.h @@ -163,7 +163,7 @@ struct IsCharPointer { */ template class Range : private boost::totally_ordered > { -public: + public: typedef std::size_t size_type; typedef Iter iterator; typedef Iter const_iterator; @@ -197,7 +197,7 @@ public: constexpr Range(const Range&) = default; constexpr Range(Range&&) = default; -public: + public: // Works for all iterators constexpr Range(Iter start, Iter end) : b_(start), e_(end) { } @@ -923,7 +923,7 @@ public: -> decltype(process(std::declval(), std::forward(args)...)) { return process(split_step(delimiter), std::forward(args)...); } -private: + private: Iter b_, e_; }; diff --git a/folly/detail/Sleeper.h b/folly/detail/Sleeper.h index 703d065b..c2efad00 100644 --- a/folly/detail/Sleeper.h +++ b/folly/detail/Sleeper.h @@ -41,7 +41,7 @@ namespace detail { uint32_t spinCount; - public: + public: Sleeper() : spinCount(0) {} void wait() { diff --git a/folly/dynamic-inl.h b/folly/dynamic-inl.h index 210dd0e3..ea8552cb 100644 --- a/folly/dynamic-inl.h +++ b/folly/dynamic-inl.h @@ -167,7 +167,7 @@ struct dynamic::ObjectMaker { return std::move(*this); } -private: + private: dynamic val_; }; diff --git a/folly/dynamic.h b/folly/dynamic.h index b099df3e..bab21a59 100644 --- a/folly/dynamic.h +++ b/folly/dynamic.h @@ -96,9 +96,10 @@ struct dynamic : private boost::operators { * Object value iterators dereference as the values in the object. * Object item iterators dereference as pairs of (key, value). */ -private: + private: typedef std::vector Array; -public: + + public: typedef Array::iterator iterator; typedef Array::const_iterator const_iterator; typedef dynamic value_type; @@ -129,11 +130,11 @@ public: * d["key"] = 12; * d["something_else"] = dynamic::array(1, 2, 3, nullptr); */ -private: + private: struct EmptyArrayTag {}; struct ObjectMaker; -public: + public: static void array(EmptyArrayTag); template static dynamic array(Args&& ...args); @@ -328,13 +329,13 @@ public: iterator begin(); iterator end(); -private: + private: /* * Helper object returned by keys(), values(), and items(). */ template struct IterableProxy; -public: + public: /* * You can iterate over the keys, values, or items (std::pair of key and * value) in an object. Calling these on non-objects will throw a TypeError. @@ -521,7 +522,7 @@ public: */ std::size_t hash() const; -private: + private: friend struct TypeError; struct ObjectImpl; template struct TypeInfo; @@ -546,7 +547,7 @@ private: void print(std::ostream&) const; void print_as_pseudo_json(std::ostream&) const; // see json.cpp -private: + private: Type type_; union Data { explicit Data() : nul(nullptr) {} diff --git a/folly/experimental/DynamicParser-inl.h b/folly/experimental/DynamicParser-inl.h index 106b8f96..c4b726b1 100644 --- a/folly/experimental/DynamicParser-inl.h +++ b/folly/experimental/DynamicParser-inl.h @@ -39,11 +39,12 @@ namespace folly { // DynamicParser.h. namespace detail { class IdentifyCallable { -public: + public: enum class Kind { Function, MemberFunction }; template constexpr static Kind getKind() { return test(nullptr); } -private: + + private: template using IsMemFn = typename boost::function_types::template is_member_pointer< decltype(&Fn::operator()) diff --git a/folly/experimental/DynamicParser.h b/folly/experimental/DynamicParser.h index 3994eb64..c84597ff 100644 --- a/folly/experimental/DynamicParser.h +++ b/folly/experimental/DynamicParser.h @@ -207,7 +207,8 @@ struct DynamicParserParseError : public std::runtime_error { * {"nested": {"key1": {"key_errors": {"key3": "err"}, "value": 7}}} */ const folly::dynamic& error() const { return error_; } -private: + + private: folly::dynamic error_; }; @@ -223,7 +224,7 @@ struct DynamicParserLogicError : public std::logic_error { }; class DynamicParser { -public: + public: enum class OnError { // After parsing, releaseErrors() reports all parse errors. // Throws DynamicParserLogicError on programmer errors. @@ -294,7 +295,7 @@ public: return *this; } -private: + private: /** * If `fn` throws an exception, wrapError() catches it and inserts an * enriched description into stack_.errors_. If lookup_key is non-null, @@ -321,7 +322,7 @@ private: explicit Pop(ParserStack* sp) : key_(sp->key_), value_(sp->value_), stackPtr_(sp) {} void operator()() noexcept; // ScopeGuard requires noexcept - private: + private: const folly::dynamic* key_; const folly::dynamic* value_; ParserStack* stackPtr_; diff --git a/folly/experimental/LockFreeRingBuffer.h b/folly/experimental/LockFreeRingBuffer.h index f863c2d2..abc5f123 100644 --- a/folly/experimental/LockFreeRingBuffer.h +++ b/folly/experimental/LockFreeRingBuffer.h @@ -57,14 +57,15 @@ class RingBufferSlot; template class Atom = std::atomic> class LockFreeRingBuffer: boost::noncopyable { + static_assert( + std::is_nothrow_default_constructible::value, + "Element type must be nothrow default constructible"); - static_assert(std::is_nothrow_default_constructible::value, - "Element type must be nothrow default constructible"); + static_assert( + FOLLY_IS_TRIVIALLY_COPYABLE(T), + "Element type must be trivially copyable"); - static_assert(FOLLY_IS_TRIVIALLY_COPYABLE(T), - "Element type must be trivially copyable"); - -public: + public: /// Opaque pointer to a past or future write. /// Can be moved relative to its current location but not in absolute terms. struct Cursor { @@ -90,7 +91,7 @@ public: return prevTicket != ticket; } - protected: // for test visibility reasons + protected: // for test visibility reasons uint64_t ticket; friend class LockFreeRingBuffer; }; @@ -162,7 +163,7 @@ public: ~LockFreeRingBuffer() { } -private: + private: const uint32_t capacity_; const std::unique_ptr[]> slots_; @@ -181,7 +182,7 @@ private: namespace detail { template class Atom> class RingBufferSlot { -public: + public: explicit RingBufferSlot() noexcept : sequencer_() , data() @@ -224,8 +225,7 @@ public: return sequencer_.isTurn((turn + 1) * 2); } - -private: + private: TurnSequencer sequencer_; T data; }; // RingBufferSlot diff --git a/folly/experimental/StringKeyedMap.h b/folly/experimental/StringKeyedMap.h index 4164cde4..b6479993 100644 --- a/folly/experimental/StringKeyedMap.h +++ b/folly/experimental/StringKeyedMap.h @@ -39,10 +39,10 @@ template >> class StringKeyedMap : private std::map { -private: + private: using Base = std::map; -public: + public: typedef typename Base::key_type key_type; typedef typename Base::mapped_type mapped_type; typedef typename Base::value_type value_type; diff --git a/folly/experimental/StringKeyedSet.h b/folly/experimental/StringKeyedSet.h index 699124dd..805e5314 100644 --- a/folly/experimental/StringKeyedSet.h +++ b/folly/experimental/StringKeyedSet.h @@ -38,10 +38,10 @@ template , class Alloc = std::allocator> class StringKeyedSetBase : private std::set { -private: + private: using Base = std::set; -public: + public: typedef typename Base::key_type key_type; typedef typename Base::value_type value_type; typedef typename Base::key_compare key_compare; diff --git a/folly/experimental/StringKeyedUnorderedMap.h b/folly/experimental/StringKeyedUnorderedMap.h index 7099332a..9acf92cd 100644 --- a/folly/experimental/StringKeyedUnorderedMap.h +++ b/folly/experimental/StringKeyedUnorderedMap.h @@ -47,7 +47,7 @@ class StringKeyedUnorderedMap private: using Base = std::unordered_map; -public: + public: typedef typename Base::key_type key_type; typedef typename Base::mapped_type mapped_type; typedef typename Base::value_type value_type; diff --git a/folly/experimental/StringKeyedUnorderedSet.h b/folly/experimental/StringKeyedUnorderedSet.h index 0956bacf..4fc1b710 100644 --- a/folly/experimental/StringKeyedUnorderedSet.h +++ b/folly/experimental/StringKeyedUnorderedSet.h @@ -45,7 +45,7 @@ class BasicStringKeyedUnorderedSet : private std::unordered_set { using Base = std::unordered_set; -public: + public: typedef typename Base::key_type key_type; typedef typename Base::value_type value_type; typedef typename Base::hasher hasher; diff --git a/folly/experimental/TestUtil.h b/folly/experimental/TestUtil.h index 2460b84b..a02a1a87 100644 --- a/folly/experimental/TestUtil.h +++ b/folly/experimental/TestUtil.h @@ -106,7 +106,7 @@ class TemporaryDirectory { * upon destruction, also changing back to the original working directory. */ class ChangeToTempDir { -public: + public: ChangeToTempDir(); ~ChangeToTempDir(); @@ -116,7 +116,7 @@ public: const fs::path& path() const { return dir_.path(); } -private: + private: fs::path initialPath_; TemporaryDirectory dir_; }; @@ -193,9 +193,10 @@ inline std::string glogErrOrWarnPattern() { return ".*(^|\n)[EW][0-9].*"; } * Great for testing logging (see also glog*Pattern()). */ class CaptureFD { -private: + private: struct NoOpChunkCob { void operator()(StringPiece) {} }; -public: + + public: using ChunkCob = std::function; /** @@ -224,7 +225,7 @@ public: */ std::string readIncremental(); -private: + private: ChunkCob chunkCob_; TemporaryFile file_; diff --git a/folly/experimental/test/StringKeyedTest.cpp b/folly/experimental/test/StringKeyedTest.cpp index 1a9a6c41..b6744459 100644 --- a/folly/experimental/test/StringKeyedTest.cpp +++ b/folly/experimental/test/StringKeyedTest.cpp @@ -106,7 +106,7 @@ struct MemoryLeakCheckerAllocator { return alloc_ == other.alloc_; } -private: + private: Alloc alloc_; }; diff --git a/folly/futures/SharedPromise.h b/folly/futures/SharedPromise.h index 2e466b1a..44987eaf 100644 --- a/folly/futures/SharedPromise.h +++ b/folly/futures/SharedPromise.h @@ -34,7 +34,7 @@ namespace folly { */ template class SharedPromise { -public: + public: SharedPromise() = default; ~SharedPromise() = default; @@ -107,7 +107,7 @@ public: bool isFulfilled(); -private: + private: std::mutex mutex_; size_t size_{0}; bool hasValue_{false}; diff --git a/folly/futures/detail/FSM.h b/folly/futures/detail/FSM.h index 9916a918..41d652b8 100644 --- a/folly/futures/detail/FSM.h +++ b/folly/futures/detail/FSM.h @@ -30,7 +30,7 @@ namespace detail { /// For best results, use an "enum class" for Enum. template class FSM { -private: + private: // I am not templatizing this because folly::MicroSpinLock needs to be // zero-initialized (or call init) which isn't generic enough for something // that behaves like std::mutex. :( @@ -43,7 +43,7 @@ private: // An optimization would be to use a static conditional on the Enum type. std::atomic state_; -public: + public: explicit FSM(Enum startState) : state_(startState) {} Enum getState() const noexcept { diff --git a/folly/futures/test/ThenCompileTest.h b/folly/futures/test/ThenCompileTest.h index aff9ff68..886e7334 100644 --- a/folly/futures/test/ThenCompileTest.h +++ b/folly/futures/test/ThenCompileTest.h @@ -65,7 +65,7 @@ aStdFunction(typename std::enable_if::value, bool>::type = true) { } class SomeClass { -public: + public: template static typename std::enable_if::value, Ret>::type diff --git a/folly/gen/Base.h b/folly/gen/Base.h index 279ec0d2..fbc224cf 100644 --- a/folly/gen/Base.h +++ b/folly/gen/Base.h @@ -84,7 +84,7 @@ namespace folly { namespace gen { class Less { -public: + public: template auto operator()(const First& first, const Second& second) const -> decltype(first < second) { @@ -93,7 +93,7 @@ public: }; class Greater { -public: + public: template auto operator()(const First& first, const Second& second) const -> decltype(first > second) { @@ -103,7 +103,7 @@ public: template class Get { -public: + public: template auto operator()(Value&& value) const -> decltype(std::get(std::forward(value))) { @@ -188,7 +188,7 @@ class Field { }; class Move { -public: + public: template auto operator()(Value&& value) const -> decltype(std::move(std::forward(value))) { diff --git a/folly/gen/Combine-inl.h b/folly/gen/Combine-inl.h index a1deb861..25048964 100644 --- a/folly/gen/Combine-inl.h +++ b/folly/gen/Combine-inl.h @@ -49,7 +49,8 @@ class Interleave : public Operator> { static_assert(std::is_same::value, "Only matching types may be interleaved"); - public: + + public: explicit Generator(Source source, const std::shared_ptr container) : source_(std::move(source)), @@ -111,7 +112,8 @@ class Zip : public Operator> { Generator> { Source source_; const std::shared_ptr container_; - public: + + public: explicit Generator(Source source, const std::shared_ptr container) : source_(std::move(source)), diff --git a/folly/gen/Core-inl.h b/folly/gen/Core-inl.h index 1097d13c..3d6c988d 100644 --- a/folly/gen/Core-inl.h +++ b/folly/gen/Core-inl.h @@ -57,7 +57,8 @@ class IsCompatibleSignature { static constexpr bool testArgs(...) { return false; } -public: + + public: static constexpr bool value = testArgs(nullptr); }; @@ -351,7 +352,8 @@ class Chain : public GenImpl> { First first_; Second second_; -public: + + public: explicit Chain(First first, Second second) : first_(std::move(first)) , second_(std::move(second)) {} diff --git a/folly/gen/ParallelMap-inl.h b/folly/gen/ParallelMap-inl.h index 22063113..906ce88a 100644 --- a/folly/gen/ParallelMap-inl.h +++ b/folly/gen/ParallelMap-inl.h @@ -146,7 +146,7 @@ class PMap : public Operator> { } }; - public: + public: Generator(Source source, const Predicate& pred, size_t nThreads) : source_(std::move(source)), pred_(pred), diff --git a/folly/io/async/AsyncServerSocket.h b/folly/io/async/AsyncServerSocket.h index 1d53bccc..f7706126 100644 --- a/folly/io/async/AsyncServerSocket.h +++ b/folly/io/async/AsyncServerSocket.h @@ -746,7 +746,7 @@ class AsyncServerSocket : public DelayedDestruction */ class RemoteAcceptor : private NotificationQueue::Consumer { - public: + public: explicit RemoteAcceptor(AcceptCallback *callback, ConnectionEventCallback *connectionEventCallback) : callback_(callback), @@ -763,7 +763,7 @@ class AsyncServerSocket : public DelayedDestruction return &queue_; } - private: + private: AcceptCallback *callback_; ConnectionEventCallback* connectionEventCallback_; diff --git a/folly/io/async/AsyncTimeout.h b/folly/io/async/AsyncTimeout.h index 2f626d84..bb02efb2 100644 --- a/folly/io/async/AsyncTimeout.h +++ b/folly/io/async/AsyncTimeout.h @@ -256,7 +256,7 @@ struct async_timeout_wrapper: callback_(); } -private: + private: TCallback callback_; }; diff --git a/folly/io/async/test/AsyncSSLSocketTest.h b/folly/io/async/test/AsyncSSLSocketTest.h index 3e400804..452d605e 100644 --- a/folly/io/async/test/AsyncSSLSocketTest.h +++ b/folly/io/async/test/AsyncSSLSocketTest.h @@ -126,7 +126,7 @@ class SendMsgDataCallback : public SendMsgFlagsCallback { class WriteCallbackBase : public AsyncTransportWrapper::WriteCallback { -public: + public: explicit WriteCallbackBase(SendMsgParamsCallbackBase* mcb = nullptr) : state(STATE_WAITING) , bytesWritten(0) @@ -171,7 +171,7 @@ public: class ExpectWriteErrorCallback : public WriteCallbackBase { -public: + public: explicit ExpectWriteErrorCallback(SendMsgParamsCallbackBase* mcb = nullptr) : WriteCallbackBase(mcb) {} @@ -198,8 +198,8 @@ enum SOF_TIMESTAMPING { }; class WriteCheckTimestampCallback : - public WriteCallbackBase { -public: + public WriteCallbackBase { + public: explicit WriteCheckTimestampCallback(SendMsgParamsCallbackBase* mcb = nullptr) : WriteCallbackBase(mcb) {} @@ -318,7 +318,7 @@ public AsyncTransportWrapper::ReadCallback { }; class ReadCallback : public ReadCallbackBase { -public: + public: explicit ReadCallback(WriteCallbackBase *wcb) : ReadCallbackBase(wcb) , buffers() {} @@ -356,7 +356,7 @@ public: } class Buffer { - public: + public: Buffer() : buffer(nullptr), length(0) {} Buffer(char* buf, size_t len) : buffer(buf), length(len) {} @@ -383,7 +383,7 @@ public: }; class ReadErrorCallback : public ReadCallbackBase { -public: + public: explicit ReadErrorCallback(WriteCallbackBase *wcb) : ReadCallbackBase(wcb) {} @@ -428,7 +428,7 @@ class ReadEOFCallback : public ReadCallbackBase { }; class WriteErrorCallback : public ReadCallback { -public: + public: explicit WriteErrorCallback(WriteCallbackBase *wcb) : ReadCallback(wcb) {} @@ -464,7 +464,7 @@ public: }; class EmptyReadCallback : public ReadCallback { -public: + public: explicit EmptyReadCallback() : ReadCallback(nullptr) {} @@ -489,7 +489,7 @@ public: class HandshakeCallback : public AsyncSSLSocket::HandshakeCB { -public: + public: enum ExpectType { EXPECT_SUCCESS, EXPECT_ERROR @@ -562,7 +562,7 @@ public: }; class SSLServerAcceptCallback: public SSLServerAcceptCallbackBase { -public: + public: uint32_t timeout_; explicit SSLServerAcceptCallback(HandshakeCallback *hcb, @@ -595,7 +595,7 @@ public: }; class SSLServerAcceptCallbackDelay: public SSLServerAcceptCallback { -public: + public: explicit SSLServerAcceptCallbackDelay(HandshakeCallback *hcb): SSLServerAcceptCallback(hcb) {} @@ -636,7 +636,7 @@ public: }; class SSLServerAsyncCacheAcceptCallback: public SSLServerAcceptCallback { -public: + public: explicit SSLServerAsyncCacheAcceptCallback(HandshakeCallback *hcb, uint32_t timeout = 0): SSLServerAcceptCallback(hcb, timeout) {} @@ -662,7 +662,7 @@ public: class HandshakeErrorCallback: public SSLServerAcceptCallbackBase { -public: + public: explicit HandshakeErrorCallback(HandshakeCallback *hcb): SSLServerAcceptCallbackBase(hcb) {} @@ -698,7 +698,7 @@ public: }; class HandshakeTimeoutCallback: public SSLServerAcceptCallbackBase { -public: + public: explicit HandshakeTimeoutCallback(HandshakeCallback *hcb): SSLServerAcceptCallbackBase(hcb) {} diff --git a/folly/io/async/test/EventBaseTest.cpp b/folly/io/async/test/EventBaseTest.cpp index 4d07fabf..1353976e 100644 --- a/folly/io/async/test/EventBaseTest.cpp +++ b/folly/io/async/test/EventBaseTest.cpp @@ -1701,7 +1701,7 @@ TEST(EventBaseTest, RunBeforeLoopWait) { } class PipeHandler : public EventHandler { -public: + public: PipeHandler(EventBase* eventBase, int fd) : EventHandler(eventBase, fd) {} diff --git a/folly/io/async/test/EventHandlerTest.cpp b/folly/io/async/test/EventHandlerTest.cpp index c40fb71d..feb2f774 100644 --- a/folly/io/async/test/EventHandlerTest.cpp +++ b/folly/io/async/test/EventHandlerTest.cpp @@ -47,7 +47,7 @@ void runInThreadsAndWait(vector> cbs) { } class EventHandlerMock : public EventHandler { -public: + public: EventHandlerMock(EventBase* eb, int fd) : EventHandler(eb, fd) {} // gmock can't mock noexcept methods, so we need an intermediary MOCK_METHOD1(_handlerReady, void(uint16_t)); @@ -57,7 +57,7 @@ public: }; class EventHandlerTest : public Test { -public: + public: int efd = 0; void SetUp() override { diff --git a/folly/io/async/test/MockAsyncServerSocket.h b/folly/io/async/test/MockAsyncServerSocket.h index c75f1f38..30652601 100644 --- a/folly/io/async/test/MockAsyncServerSocket.h +++ b/folly/io/async/test/MockAsyncServerSocket.h @@ -24,7 +24,7 @@ namespace folly { namespace test { class MockAsyncServerSocket : public AsyncServerSocket { -public: + public: typedef std::unique_ptr UniquePtr; // We explicitly do not mock destroy(), since the base class implementation diff --git a/folly/json.cpp b/folly/json.cpp index 07db1c33..03a2b52f 100644 --- a/folly/json.cpp +++ b/folly/json.cpp @@ -85,7 +85,7 @@ struct Printer { } } -private: + private: void printKV(const std::pair& p) const { if (!opts_.allow_non_string_keys && !p.first.isString()) { throw std::runtime_error("folly::toJson: JSON object key was not a " @@ -156,7 +156,7 @@ private: out_ += ']'; } -private: + private: void outdent() const { if (indentLevel_) { --*indentLevel_; @@ -179,10 +179,10 @@ private: out_ += indentLevel_ ? " : " : ":"; } -private: - std::string& out_; - unsigned* const indentLevel_; - serialization_opts const& opts_; + private: + std::string& out_; + unsigned* const indentLevel_; + serialization_opts const& opts_; }; ////////////////////////////////////////////////////////////////////// @@ -319,7 +319,7 @@ struct Input { current_ = range_.empty() ? EOF : range_.front(); } -private: + private: StringPiece range_; json::serialization_opts const& opts_; unsigned lineNum_; diff --git a/folly/small_vector.h b/folly/small_vector.h index 71893a3c..0e148ef7 100644 --- a/folly/small_vector.h +++ b/folly/small_vector.h @@ -236,7 +236,7 @@ namespace detail { IntegralSizePolicy() : size_(0) {} - protected: + protected: static constexpr std::size_t policyMaxSize() { return SizeType(~kExternMask); } @@ -266,10 +266,10 @@ namespace detail { std::swap(size_, o.size_); } - protected: + protected: static bool const kShouldUseHeap = ShouldUseHeap; - private: + private: static SizeType const kExternMask = kShouldUseHeap ? SizeType(1) << (sizeof(SizeType) * 8 - 1) : 0; @@ -826,8 +826,7 @@ class small_vector return (*this)[i]; } -private: - + private: static iterator unconst(const_iterator it) { return const_cast(it); } @@ -1020,7 +1019,7 @@ private: } } -private: + private: struct HeapPtrWithCapacity { void* heap_; InternalSizeType capacity_; diff --git a/folly/sorted_vector_types.h b/folly/sorted_vector_types.h index 6d988efd..7056ead2 100644 --- a/folly/sorted_vector_types.h +++ b/folly/sorted_vector_types.h @@ -213,7 +213,7 @@ class sorted_vector_set detail::growth_policy_wrapper& get_growth_policy() { return *this; } -public: + public: typedef T value_type; typedef T key_type; typedef Compare key_compare; @@ -403,7 +403,7 @@ public: return m_.cont_ < other.m_.cont_; } -private: + private: /* * This structure derives from the comparison object in order to * make use of the empty base class optimization if our comparison @@ -464,7 +464,7 @@ class sorted_vector_map detail::growth_policy_wrapper& get_growth_policy() { return *this; } -public: + public: typedef Key key_type; typedef Value mapped_type; typedef std::pair value_type; @@ -475,7 +475,7 @@ public: return Compare::operator()(a.first, b.first); } - protected: + protected: friend class sorted_vector_map; explicit value_compare(const Compare& c) : Compare(c) {} }; @@ -706,7 +706,7 @@ public: return m_.cont_ < other.m_.cont_; } -private: + private: // This is to get the empty base optimization; see the comment in // sorted_vector_set. struct EBO : value_compare { diff --git a/folly/test/ApplyTupleTest.cpp b/folly/test/ApplyTupleTest.cpp index fa9a575b..a09f8074 100644 --- a/folly/test/ApplyTupleTest.cpp +++ b/folly/test/ApplyTupleTest.cpp @@ -100,7 +100,7 @@ struct GuardObj : GuardObjBase { GuardObj(const GuardObj&) = delete; GuardObj& operator=(const GuardObj&) = delete; -private: + private: F f_; Tuple args_; }; diff --git a/folly/test/ArenaSmartPtrTest.cpp b/folly/test/ArenaSmartPtrTest.cpp index 5dddd97e..911c3c37 100644 --- a/folly/test/ArenaSmartPtrTest.cpp +++ b/folly/test/ArenaSmartPtrTest.cpp @@ -40,7 +40,7 @@ struct global_counter { unsigned count() const { return count_; } -private: + private: unsigned count_; }; @@ -55,7 +55,7 @@ struct Foo { counter_.decrease(); } -private: + private: global_counter& counter_; }; diff --git a/folly/test/AtomicHashMapTest.cpp b/folly/test/AtomicHashMapTest.cpp index ee2968db..147d2238 100644 --- a/folly/test/AtomicHashMapTest.cpp +++ b/folly/test/AtomicHashMapTest.cpp @@ -262,13 +262,13 @@ TEST(Ahm, iterator) { } class Counters { -private: + private: // Note: Unfortunately can't currently put a std::atomic in // the value in ahm since it doesn't support types that are both non-copy // and non-move constructible yet. AtomicHashMap ahm; -public: + public: explicit Counters(size_t numCounters) : ahm(numCounters) {} void increment(int64_t obj_id) { diff --git a/folly/test/ContainerTraitsTest.cpp b/folly/test/ContainerTraitsTest.cpp index f1f4090f..14d27c3f 100644 --- a/folly/test/ContainerTraitsTest.cpp +++ b/folly/test/ContainerTraitsTest.cpp @@ -30,7 +30,7 @@ struct Node { template class VectorWrapper { -public: + public: using value_type = T; vector& underlying; explicit VectorWrapper(vector& v) : underlying(v) {} diff --git a/folly/test/OptionalTest.cpp b/folly/test/OptionalTest.cpp index df1e5c4a..365d8e41 100644 --- a/folly/test/OptionalTest.cpp +++ b/folly/test/OptionalTest.cpp @@ -111,7 +111,7 @@ TEST(Optional, Simple) { } class MoveTester { -public: + public: /* implicit */ MoveTester(const char* s) : s_(s) {} MoveTester(const MoveTester&) = default; MoveTester(MoveTester&& other) noexcept { @@ -124,7 +124,8 @@ public: other.s_ = ""; return *this; } -private: + + private: friend bool operator==(const MoveTester& o1, const MoveTester& o2); std::string s_; }; diff --git a/folly/test/ScopeGuardTest.cpp b/folly/test/ScopeGuardTest.cpp index 7095df5f..853c7b29 100644 --- a/folly/test/ScopeGuardTest.cpp +++ b/folly/test/ScopeGuardTest.cpp @@ -228,7 +228,7 @@ TEST(ScopeGuard, TEST_SCOPE_EXIT) { } class Foo { -public: + public: Foo() {} ~Foo() { try { diff --git a/folly/test/stl_tests/StlVectorTest.cpp b/folly/test/stl_tests/StlVectorTest.cpp index 257a0e8d..42920e13 100644 --- a/folly/test/stl_tests/StlVectorTest.cpp +++ b/folly/test/stl_tests/StlVectorTest.cpp @@ -595,7 +595,7 @@ struct Data : DataTracker<(f & IS_RELOCATABLE) != 0>, Data& operator=(const Data&) = default; Data& operator=(Data&&) = default; -private: + private: int operator&() const; }; @@ -1473,7 +1473,8 @@ class DataState { typedef typename Vector::size_type size_type; size_type size_; int* data_; -public: + + public: /* implicit */ DataState(const Vector& v) { size_ = v.size(); if (size_ != 0) { @@ -1519,7 +1520,7 @@ class Transformer : public boost::iterator_adaptor< friend class boost::iterator_core_access; shared_ptr> dereferenced; -public: + public: explicit Transformer(const It& it) : Transformer::iterator_adaptor_(it) , dereferenced(new set()) {}