Commit f498404b authored by Andres Suarez's avatar Andres Suarez Committed by Facebook GitHub Bot

Apply clang-format

Reviewed By: igorsugak

Differential Revision: D28582083

fbshipit-source-id: 9beedfccfd1fc6b9dc4f7ff8ab0139282bd285ab
parent beded0e8
......@@ -163,9 +163,8 @@ beginInsertInternal:
if (tryLockMap(nextMapIdx)) {
// Alloc a new map and shove it in. We can change whatever
// we want because other threads are waiting on us...
size_t numCellsAllocated = (size_t)(
primarySubMap->capacity_ *
std::pow(1.0 + kGrowthFrac_, nextMapIdx - 1));
size_t numCellsAllocated =
(size_t)(primarySubMap->capacity_ * std::pow(1.0 + kGrowthFrac_, nextMapIdx - 1));
size_t newSize = size_t(numCellsAllocated * kGrowthFrac_);
DCHECK(
subMaps_[nextMapIdx].load(std::memory_order_relaxed) ==
......
......@@ -312,9 +312,8 @@ auto getLastElement(const Ts&... ts)
}
template <class... Ts>
struct LastElement : std::decay<decltype(
LastElementImpl<Ts...>::call(std::declval<Ts>()...))> {
};
struct LastElement : std::decay<decltype(LastElementImpl<Ts...>::call(
std::declval<Ts>()...))> {};
#endif
} // namespace detail
......@@ -1420,8 +1419,8 @@ parseToWrap(StringPiece sp, Tgt& out) {
}
template <typename Tgt>
using ParseToError = ExpectedErrorType<decltype(
detail::parseToWrap(StringPiece{}, std::declval<Tgt&>()))>;
using ParseToError = ExpectedErrorType<decltype(detail::parseToWrap(
StringPiece{}, std::declval<Tgt&>()))>;
} // namespace detail
......
......@@ -1103,8 +1103,8 @@ class Expected final : expected_detail::ExpectedStorage<Value, Error> {
* then
*/
template <class... Fns FOLLY_REQUIRES_TRAILING(sizeof...(Fns) >= 1)>
auto then(Fns&&... fns) const& -> decltype(
expected_detail::ExpectedHelper::then_(
auto then(Fns&&... fns)
const& -> decltype(expected_detail::ExpectedHelper::then_(
std::declval<const Base&>(), std::declval<Fns>()...)) {
if (this->uninitializedByException()) {
throw_exception<BadExpectedAccess>();
......@@ -1137,8 +1137,8 @@ class Expected final : expected_detail::ExpectedStorage<Value, Error> {
* thenOrThrow
*/
template <class Yes, class No = MakeBadExpectedAccess>
auto thenOrThrow(Yes&& yes, No&& no = No{}) const& -> decltype(
std::declval<Yes>()(std::declval<const Value&>())) {
auto thenOrThrow(Yes&& yes, No&& no = No{})
const& -> decltype(std::declval<Yes>()(std::declval<const Value&>())) {
using Ret = decltype(std::declval<Yes>()(std::declval<const Value&>()));
if (this->uninitializedByException()) {
throw_exception<BadExpectedAccess>();
......@@ -1148,8 +1148,8 @@ class Expected final : expected_detail::ExpectedStorage<Value, Error> {
}
template <class Yes, class No = MakeBadExpectedAccess>
auto thenOrThrow(Yes&& yes, No&& no = No{}) & -> decltype(
std::declval<Yes>()(std::declval<Value&>())) {
auto thenOrThrow(Yes&& yes, No&& no = No{}) & -> decltype(std::declval<Yes>()(
std::declval<Value&>())) {
using Ret = decltype(std::declval<Yes>()(std::declval<Value&>()));
if (this->uninitializedByException()) {
throw_exception<BadExpectedAccess>();
......@@ -1159,8 +1159,10 @@ class Expected final : expected_detail::ExpectedStorage<Value, Error> {
}
template <class Yes, class No = MakeBadExpectedAccess>
auto thenOrThrow(Yes&& yes, No&& no = No{}) && -> decltype(
std::declval<Yes>()(std::declval<Value&&>())) {
auto thenOrThrow(
Yes&& yes,
No&& no =
No{}) && -> decltype(std::declval<Yes>()(std::declval<Value&&>())) {
using Ret = decltype(std::declval<Yes>()(std::declval<Value&&>()));
if (this->uninitializedByException()) {
throw_exception<BadExpectedAccess>();
......
......@@ -70,8 +70,8 @@ struct ValueTypeForTransparentConversionToRange {
template <typename T>
struct ValueTypeForTransparentConversionToRange<
T,
void_t<decltype(
std::declval<hasher<Range<typename T::value_type const*>>>()(
void_t<
decltype(std::declval<hasher<Range<typename T::value_type const*>>>()(
std::declval<Range<typename T::value_type const*>>()))>> {
using type = std::remove_const_t<typename T::value_type>;
};
......
......@@ -59,8 +59,8 @@ struct ArgumentTypesByKind {};
template <typename Fn>
struct ArgumentTypesByKind<IdentifyCallable::Kind::MemberFunction, Fn> {
using type = typename boost::mpl::template pop_front<
typename boost::function_types::template parameter_types<decltype(
&Fn::operator())>::type>::type;
typename boost::function_types::template parameter_types<
decltype(&Fn::operator())>::type>::type;
};
template <typename Fn>
struct ArgumentTypesByKind<IdentifyCallable::Kind::Function, Fn> {
......
......@@ -45,8 +45,8 @@ bool folly::JemallocHugePageAllocator::hugePagesSupported{true};
#if !defined(JEMALLOC_VERSION_MAJOR) || (JEMALLOC_VERSION_MAJOR < 5)
typedef struct extent_hooks_s extent_hooks_t;
typedef void*(extent_alloc_t)(
extent_hooks_t*, void*, size_t, size_t, bool*, bool*, unsigned);
typedef void*(
extent_alloc_t)(extent_hooks_t*, void*, size_t, size_t, bool*, bool*, unsigned);
struct extent_hooks_s {
extent_alloc_t* alloc;
};
......
......@@ -353,8 +353,8 @@ auto collectAllTryWindowed(InputRange awaitables, std::size_t maxConcurrency)
template <typename SemiAwaitable>
auto collectAllWindowed(
std::vector<SemiAwaitable> awaitables, std::size_t maxConcurrency)
-> decltype(
collectAllWindowed(awaitables | ranges::views::move, maxConcurrency)) {
-> decltype(collectAllWindowed(
awaitables | ranges::views::move, maxConcurrency)) {
co_return co_await collectAllWindowed(
awaitables | ranges::views::move, maxConcurrency);
}
......
......@@ -195,8 +195,9 @@ class StackAwareViaIfAsyncAwaiter {
using CoroutinePromise = typename CoroutineType::promise_type;
using WrapperHandle = coroutine_handle<CoroutinePromise>;
using await_suspend_result_t = decltype(
std::declval<Awaiter&>().await_suspend(std::declval<WrapperHandle>()));
using await_suspend_result_t =
decltype(std::declval<Awaiter&>().await_suspend(
std::declval<WrapperHandle>()));
public:
explicit StackAwareViaIfAsyncAwaiter(
......@@ -255,8 +256,9 @@ class ViaIfAsyncAwaiter {
using CoroutinePromise = typename CoroutineType::promise_type;
using WrapperHandle = coroutine_handle<CoroutinePromise>;
using await_suspend_result_t = decltype(
std::declval<Awaiter&>().await_suspend(std::declval<WrapperHandle>()));
using await_suspend_result_t =
decltype(std::declval<Awaiter&>().await_suspend(
std::declval<WrapperHandle>()));
public:
explicit ViaIfAsyncAwaiter(
......
......@@ -42,8 +42,8 @@ struct WithCancellationFunction {
const folly::CancellationToken& cancelToken, Awaitable&& awaitable) const
noexcept(
noexcept(co_withCancellation(cancelToken, (Awaitable &&) awaitable)))
-> decltype(
co_withCancellation(cancelToken, (Awaitable &&) awaitable)) {
-> decltype(co_withCancellation(
cancelToken, (Awaitable &&) awaitable)) {
return co_withCancellation(cancelToken, (Awaitable &&) awaitable);
}
......
......@@ -253,7 +253,7 @@ class Recursion {
InlineTask<int> operator co_await() {
if (child_) {
co_return co_await* child_ + 1;
co_return co_await *child_ + 1;
}
co_return 0;
}
......
......@@ -62,8 +62,9 @@ static_assert(
"");
static_assert(
std::is_same<
folly::coro::semi_await_result_t<decltype(
std::declval<folly::coro::SharedMutex&>().co_scoped_lock_shared())>,
folly::coro::semi_await_result_t<
decltype(std::declval<folly::coro::SharedMutex&>()
.co_scoped_lock_shared())>,
folly::coro::SharedLock<folly::coro::SharedMutex>>::value,
"");
......
......@@ -179,8 +179,8 @@ using TypeIdentityT = typename TypeIdentity<T>::type;
Aggregate all off these together in a single section for better TLB \
and cache locality. */ \
__attribute__((__section__(".folly.settings.cache"))) \
std::atomic<folly::settings::detail::SettingCore<_Type>*> \
FOLLY_SETTINGS_CACHE__##_project##_##_name; \
std::atomic<folly::settings::detail::SettingCore<_Type>*> \
FOLLY_SETTINGS_CACHE__##_project##_##_name; \
/* Location for the small value cache (if _Type is small and trivial). \
Intentionally located right after the pointer cache above to take \
advantage of the prefetching */ \
......
......@@ -510,8 +510,8 @@ void UnsafeSelfAllocateStackTracePrinter::printSymbolizedStackTrace() {
makecontext(
&alt,
(void (*)())(void (*)(UnsafeSelfAllocateStackTracePrinter*))(
contextStart),
(void (*)())(void (*)(
UnsafeSelfAllocateStackTracePrinter*))(contextStart),
/* argc */ 1,
/* arg */ this);
// NOTE: swapcontext is not async-signal-safe
......
......@@ -80,8 +80,8 @@ struct ApplyInvoke {
static constexpr auto
invoke_(F&& f, T&& t, std::index_sequence<I...>) noexcept(
noexcept(invoke(static_cast<F&&>(f), get<I>{}(static_cast<T&&>(t))...)))
-> decltype(
invoke(static_cast<F&&>(f), get<I>{}(static_cast<T&&>(t))...)) {
-> decltype(invoke(
static_cast<F&&>(f), get<I>{}(static_cast<T&&>(t))...)) {
return invoke(static_cast<F&&>(f), get<I>{}(static_cast<T&&>(t))...);
}
......
......@@ -495,8 +495,8 @@ struct tag_invoke_fn {
template <typename Tag, typename... Args>
constexpr auto operator()(Tag tag, Args&&... args) const noexcept(noexcept(
tag_invoke(static_cast<Tag&&>(tag), static_cast<Args&&>(args)...)))
-> decltype(
tag_invoke(static_cast<Tag&&>(tag), static_cast<Args&&>(args)...)) {
-> decltype(tag_invoke(
static_cast<Tag&&>(tag), static_cast<Args&&>(args)...)) {
return tag_invoke(static_cast<Tag&&>(tag), static_cast<Args&&>(args)...);
}
};
......
......@@ -2057,8 +2057,8 @@ template <
class F,
class ItT = typename std::iterator_traits<It>::value_type,
class Tag = std::enable_if_t<is_invocable_v<F, typename ItT::value_type&&>>,
class Result = typename decltype(
std::declval<ItT>().thenValue(std::declval<F>()))::value_type>
class Result = typename decltype(std::declval<ItT>().thenValue(
std::declval<F>()))::value_type>
std::vector<Future<Result>> mapValue(It first, It last, F func);
/**
......@@ -2071,8 +2071,8 @@ template <
class ItT = typename std::iterator_traits<It>::value_type,
class Tag =
std::enable_if_t<!is_invocable_v<F, typename ItT::value_type&&>>,
class Result = typename decltype(
std::declval<ItT>().thenTry(std::declval<F>()))::value_type>
class Result = typename decltype(std::declval<ItT>().thenTry(
std::declval<F>()))::value_type>
std::vector<Future<Result>> mapTry(It first, It last, F func, int = 0);
/**
......
......@@ -148,22 +148,24 @@ auto add_to_tuple(std::tuple<Types1...> t1, std::tuple<Types2...> t2)
}
template <class... Types1, class Type2>
auto add_to_tuple(std::tuple<Types1...> t1, Type2&& t2) -> decltype(
std::tuple_cat(std::move(t1), std::make_tuple(std::forward<Type2>(t2)))) {
auto add_to_tuple(std::tuple<Types1...> t1, Type2&& t2)
-> decltype(std::tuple_cat(
std::move(t1), std::make_tuple(std::forward<Type2>(t2)))) {
return std::tuple_cat(
std::move(t1), std::make_tuple(std::forward<Type2>(t2)));
}
template <class Type1, class... Types2>
auto add_to_tuple(Type1&& t1, std::tuple<Types2...> t2) -> decltype(
std::tuple_cat(std::make_tuple(std::forward<Type1>(t1)), std::move(t2))) {
auto add_to_tuple(Type1&& t1, std::tuple<Types2...> t2)
-> decltype(std::tuple_cat(
std::make_tuple(std::forward<Type1>(t1)), std::move(t2))) {
return std::tuple_cat(
std::make_tuple(std::forward<Type1>(t1)), std::move(t2));
}
template <class Type1, class Type2>
auto add_to_tuple(Type1&& t1, Type2&& t2) -> decltype(
std::make_tuple(std::forward<Type1>(t1), std::forward<Type2>(t2))) {
auto add_to_tuple(Type1&& t1, Type2&& t2) -> decltype(std::make_tuple(
std::forward<Type1>(t1), std::forward<Type2>(t2))) {
return std::make_tuple(std::forward<Type1>(t1), std::forward<Type2>(t2));
}
......
......@@ -31,25 +31,25 @@
#define FOLLY_DETAIL_SAFE_CHECK_LINKAGE static
#endif
#define FOLLY_DETAIL_SAFE_CHECK_IMPL(d, p, expr, expr_s, ...) \
do { \
if ((!d || ::folly::kIsDebug || ::folly::kIsSanitize) && \
!static_cast<bool>(expr)) { \
FOLLY_DETAIL_SAFE_CHECK_LINKAGE constexpr auto \
__folly_detail_safe_assert_fun = __func__; \
FOLLY_DETAIL_SAFE_CHECK_LINKAGE constexpr ::folly::detail:: \
safe_assert_arg __folly_detail_safe_assert_arg{ \
FOLLY_PP_STRINGIZE(expr_s), \
__FILE__, \
__LINE__, \
__folly_detail_safe_assert_fun, \
::folly::detail::safe_assert_msg_types<decltype( \
::folly::detail::safe_assert_msg_types_seq_of( \
__VA_ARGS__))>::value.data}; \
::folly::detail::safe_assert_terminate<p>( \
__folly_detail_safe_assert_arg FOLLY_PP_DETAIL_APPEND_VA_ARG( \
__VA_ARGS__)); \
} \
#define FOLLY_DETAIL_SAFE_CHECK_IMPL(d, p, expr, expr_s, ...) \
do { \
if ((!d || ::folly::kIsDebug || ::folly::kIsSanitize) && \
!static_cast<bool>(expr)) { \
FOLLY_DETAIL_SAFE_CHECK_LINKAGE constexpr auto \
__folly_detail_safe_assert_fun = __func__; \
FOLLY_DETAIL_SAFE_CHECK_LINKAGE constexpr ::folly::detail:: \
safe_assert_arg __folly_detail_safe_assert_arg{ \
FOLLY_PP_STRINGIZE(expr_s), \
__FILE__, \
__LINE__, \
__folly_detail_safe_assert_fun, \
::folly::detail::safe_assert_msg_types< \
decltype(::folly::detail::safe_assert_msg_types_seq_of( \
__VA_ARGS__))>::value.data}; \
::folly::detail::safe_assert_terminate<p>( \
__folly_detail_safe_assert_arg FOLLY_PP_DETAIL_APPEND_VA_ARG( \
__VA_ARGS__)); \
} \
} while (false)
// FOLLY_SAFE_CHECK
......
......@@ -89,9 +89,8 @@ namespace detail {
using folly::toAppend;
template <typename Arg>
auto appendObjectToString(std::string& str, const Arg* arg, int) -> decltype(
toAppend(std::declval<Arg>(), std::declval<std::string*>()),
std::declval<void>()) {
auto appendObjectToString(std::string& str, const Arg* arg, int)
-> decltype(toAppend(std::declval<Arg>(), std::declval<std::string*>()), std::declval<void>()) {
::folly::catch_exception(
[&] { toAppend(*arg, &str); },
// If anything goes wrong in `toAppend()` fall back to
......
......@@ -401,8 +401,8 @@ struct MakeUnsafeVectorSetLargerSize : std::vector<T> {
&std::vector<TYPE>::_Mypair, \
decltype(&decltype(std::declval<std::vector<TYPE>>()._Mypair)::_Myval2), \
&decltype(std::declval<std::vector<TYPE>>()._Mypair)::_Myval2, \
decltype(&decltype( \
std::declval<std::vector<TYPE>>()._Mypair._Myval2)::_Mylast), \
decltype(&decltype(std::declval<std::vector<TYPE>>() \
._Mypair._Myval2)::_Mylast), \
&decltype(std::declval<std::vector<TYPE>>()._Mypair._Myval2)::_Mylast>; \
FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT_IMPL(TYPE)
......
......@@ -84,7 +84,7 @@ TEST(Expected, CoroutineSuccess) {
EXPECT_EQ(2.0 * 7, y);
auto z = co_await f3(x, y);
EXPECT_EQ(int(2.0 * 7 + 7), *z);
co_return* z;
co_return *z;
}();
EXPECT_TRUE(r0.hasValue());
EXPECT_EQ(21, *r0);
......
......@@ -42,7 +42,7 @@ TEST(Optional, CoroutineSuccess) {
EXPECT_EQ(2.0 * 7, y);
auto z = co_await f3(x, y);
EXPECT_EQ((int)(2.0 * 7 + 7), *z);
co_return* z;
co_return *z;
}();
EXPECT_TRUE(r0.has_value());
EXPECT_EQ(21, *r0);
......
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