Commit 96652b6f authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Apply clang-format in places

Summary: [Folly] Apply `clang-format` in places.

Reviewed By: markisaa

Differential Revision: D19249033

fbshipit-source-id: 1a768eea013112ee5cd9d8b78114927fd6d6db04
parent 88065016
...@@ -292,7 +292,6 @@ TEST(F14Set, equalityRefinement) { ...@@ -292,7 +292,6 @@ TEST(F14Set, equalityRefinement) {
#include <string> #include <string>
#include <unordered_set> #include <unordered_set>
using namespace folly; using namespace folly;
using namespace folly::f14; using namespace folly::f14;
using namespace folly::string_piece_literals; using namespace folly::string_piece_literals;
......
...@@ -1911,8 +1911,7 @@ void AsyncSSLSocket::clientHelloParsingCallback( ...@@ -1911,8 +1911,7 @@ void AsyncSSLSocket::clientHelloParsingCallback(
uint8_t>::value, uint8_t>::value,
"unexpected underlying type"); "unexpected underlying type");
auto typ = auto typ = static_cast<ssl::NameType>(cursor.readBE<uint8_t>());
static_cast<ssl::NameType>(cursor.readBE<uint8_t>());
auto nameLength = cursor.readBE<uint16_t>(); auto nameLength = cursor.readBE<uint16_t>();
if (typ == NameType::HOST_NAME && if (typ == NameType::HOST_NAME &&
......
...@@ -35,17 +35,17 @@ ...@@ -35,17 +35,17 @@
* @param expectedMS The timeout duration, in milliseconds * @param expectedMS The timeout duration, in milliseconds
* @param tolerance The tolerance, in milliseconds. * @param tolerance The tolerance, in milliseconds.
*/ */
#define T_CHECK_TIMEOUT(start, end, expectedMS, ...) \ #define T_CHECK_TIMEOUT(start, end, expectedMS, ...) \
if (!::folly::checkTimeout( \ if (!::folly::checkTimeout( \
(start), (end), (expectedMS), false, ##__VA_ARGS__)) { \ (start), (end), (expectedMS), false, ##__VA_ARGS__)) { \
ADD_FAILURE() \ ADD_FAILURE() << "Timeout violates constraints, expectedMs = " \
<< "Timeout violates constraints, expectedMs = " \ << std::chrono::duration_cast<std::chrono::milliseconds>( \
<< std::chrono::duration_cast<std::chrono::milliseconds>(expectedMS) \ expectedMS) \
.count() \ .count() \
<< ", elapsed wall time ms = " \ << ", elapsed wall time ms = " \
<< std::chrono::duration_cast<std::chrono::milliseconds>( \ << std::chrono::duration_cast<std::chrono::milliseconds>( \
(end).getTime() - (start).getTime()) \ (end).getTime() - (start).getTime()) \
.count(); \ .count(); \
} }
/** /**
...@@ -54,15 +54,15 @@ ...@@ -54,15 +54,15 @@
* This is similar to T_CHECK_TIMEOUT, but does not fail if the event took less * This is similar to T_CHECK_TIMEOUT, but does not fail if the event took less
* than the allowed time. * than the allowed time.
*/ */
#define T_CHECK_TIME_LT(start, end, expectedMS, ...) \ #define T_CHECK_TIME_LT(start, end, expectedMS, ...) \
if (!::folly::checkTimeout( \ if (!::folly::checkTimeout( \
(start), (end), (expectedMS), true, ##__VA_ARGS__)) { \ (start), (end), (expectedMS), true, ##__VA_ARGS__)) { \
ADD_FAILURE() \ ADD_FAILURE() << "Interval violates constraints, expectedMs = " \
<< "Interval violates constraints, expectedMs = " \ << std::chrono::duration_cast<std::chrono::milliseconds>( \
<< std::chrono::duration_cast<std::chrono::milliseconds>(expectedMS) \ expectedMS) \
.count() \ .count() \
<< ", elapsed wall time ms = " \ << ", elapsed wall time ms = " \
<< std::chrono::duration_cast<std::chrono::milliseconds>( \ << std::chrono::duration_cast<std::chrono::milliseconds>( \
(end).getTime() - (start).getTime()) \ (end).getTime() - (start).getTime()) \
.count(); \ .count(); \
} }
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <folly/Benchmark.h> #include <folly/Benchmark.h>
BENCHMARK(nextPowTwoClz, iters) { BENCHMARK(nextPowTwoClz, iters) {
for (unsigned long i = 0; i < iters; ++i) { for (unsigned long i = 0; i < iters; ++i) {
auto x = folly::nextPowTwo(i); auto x = folly::nextPowTwo(i);
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <folly/Benchmark.h> #include <folly/Benchmark.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
// clang-format off // clang-format off
[[noreturn]] void fail() { [[noreturn]] void fail() {
FOLLY_SAFE_CHECK(0 + 0, "hello"); FOLLY_SAFE_CHECK(0 + 0, "hello");
......
...@@ -24,8 +24,7 @@ ThreadCachedArena::ThreadCachedArena(size_t minBlockSize, size_t maxAlign) ...@@ -24,8 +24,7 @@ ThreadCachedArena::ThreadCachedArena(size_t minBlockSize, size_t maxAlign)
: minBlockSize_(minBlockSize), maxAlign_(maxAlign) {} : minBlockSize_(minBlockSize), maxAlign_(maxAlign) {}
SysArena* ThreadCachedArena::allocateThreadLocalArena() { SysArena* ThreadCachedArena::allocateThreadLocalArena() {
auto arena = auto arena = new SysArena(minBlockSize_, SysArena::kNoSizeLimit, maxAlign_);
new SysArena(minBlockSize_, SysArena::kNoSizeLimit, maxAlign_);
auto disposer = [this](SysArena* t, TLPDestructionMode mode) { auto disposer = [this](SysArena* t, TLPDestructionMode mode) {
std::unique_ptr<SysArena> tp(t); // ensure it gets deleted std::unique_ptr<SysArena> tp(t); // ensure it gets deleted
if (mode == TLPDestructionMode::THIS_THREAD) { if (mode == TLPDestructionMode::THIS_THREAD) {
......
...@@ -261,8 +261,7 @@ TDigest TDigest::merge(Range<const TDigest*> digests) { ...@@ -261,8 +261,7 @@ TDigest TDigest::merge(Range<const TDigest*> digests) {
// It is possible that the next block is incomplete (less than // It is possible that the next block is incomplete (less than
// digestsPerBlock big). In that case, merge to end. Otherwise, merge to // digestsPerBlock big). In that case, merge to end. Otherwise, merge to
// the end of that block. // the end of that block.
auto last = auto last = (i + (digestsPerBlock * 2) < starts.size())
(i + (digestsPerBlock * 2) < starts.size())
? *(starts.begin() + i + 2 * digestsPerBlock) ? *(starts.begin() + i + 2 * digestsPerBlock)
: centroids.end(); : centroids.end();
std::inplace_merge(first, middle, last); std::inplace_merge(first, middle, last);
......
...@@ -589,7 +589,6 @@ TEST(DistributedMutex, BasicTryLock) { ...@@ -589,7 +589,6 @@ TEST(DistributedMutex, BasicTryLock) {
} }
TEST(DistributedMutex, TestSingleElementContentionChain) { TEST(DistributedMutex, TestSingleElementContentionChain) {
// Acquire the mutex once, let another thread form a contention chain on the // Acquire the mutex once, let another thread form a contention chain on the
// mutex, and then release it. Observe the other thread grab the lock // mutex, and then release it. Observe the other thread grab the lock
auto&& schedule = test::ManualSchedule{}; auto&& schedule = test::ManualSchedule{};
...@@ -620,7 +619,6 @@ TEST(DistributedMutex, TestSingleElementContentionChain) { ...@@ -620,7 +619,6 @@ TEST(DistributedMutex, TestSingleElementContentionChain) {
} }
TEST(DistributedMutex, TestTwoElementContentionChain) { TEST(DistributedMutex, TestTwoElementContentionChain) {
// Acquire the mutex once, let another thread form a contention chain on the // Acquire the mutex once, let another thread form a contention chain on the
// mutex, and then release it. Observe the other thread grab the lock // mutex, and then release it. Observe the other thread grab the lock
auto&& schedule = test::ManualSchedule{}; auto&& schedule = test::ManualSchedule{};
...@@ -667,7 +665,6 @@ TEST(DistributedMutex, TestTwoElementContentionChain) { ...@@ -667,7 +665,6 @@ TEST(DistributedMutex, TestTwoElementContentionChain) {
} }
TEST(DistributedMutex, TestTwoContentionChains) { TEST(DistributedMutex, TestTwoContentionChains) {
auto&& schedule = test::ManualSchedule{}; auto&& schedule = test::ManualSchedule{};
auto&& mutex = test::TestDistributedMutex<test::ManualAtomic>{}; auto&& mutex = test::TestDistributedMutex<test::ManualAtomic>{};
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <folly/portability/SysMman.h> #include <folly/portability/SysMman.h>
#include <folly/synchronization/test/Barrier.h> #include <folly/synchronization/test/Barrier.h>
using namespace folly::test; using namespace folly::test;
namespace { namespace {
......
...@@ -809,12 +809,16 @@ struct LargePODConstructTo { ...@@ -809,12 +809,16 @@ struct LargePODConstructTo {
struct NonPODConstructTo { struct NonPODConstructTo {
explicit NonPODConstructTo(Source) {} explicit NonPODConstructTo(Source) {}
NonPODConstructTo(NonPODConstructTo const&) {} NonPODConstructTo(NonPODConstructTo const&) {}
NonPODConstructTo& operator=(NonPODConstructTo const&) { return *this; } NonPODConstructTo& operator=(NonPODConstructTo const&) {
return *this;
}
}; };
struct ConvertTo { struct ConvertTo {
explicit ConvertTo(Source) {} explicit ConvertTo(Source) {}
ConvertTo& operator=(Source) { return *this; } ConvertTo& operator=(Source) {
return *this;
}
}; };
static_assert( static_assert(
...@@ -840,7 +844,8 @@ static_assert(constructibleNotConvertible<SmallPODConstructTo>(), ""); ...@@ -840,7 +844,8 @@ static_assert(constructibleNotConvertible<SmallPODConstructTo>(), "");
static_assert(constructibleNotConvertible<LargePODConstructTo>(), ""); static_assert(constructibleNotConvertible<LargePODConstructTo>(), "");
static_assert(constructibleNotConvertible<NonPODConstructTo>(), ""); static_assert(constructibleNotConvertible<NonPODConstructTo>(), "");
static_assert(expected_detail::IsConvertible<Source, ConvertTo>(), static_assert(
expected_detail::IsConvertible<Source, ConvertTo>(),
"convertible"); "convertible");
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment