Commit f68a5213 authored by Igor Sugak's avatar Igor Sugak Committed by Facebook Github Bot

update clang-format in fbsource and format folly

Reviewed By: zertosh

Differential Revision: D9993527

fbshipit-source-id: 52c4c0bfe6b5c73c652dd350f599fb846a003a4f
parent 0289870c
...@@ -591,7 +591,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> { ...@@ -591,7 +591,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> {
// Make sure Objective C blocks are copied // Make sure Objective C blocks are copied
template <class ReturnType, class... Args> template <class ReturnType, class... Args>
/*implicit*/ Function(ReturnType (^objCBlock)(Args... args)) /*implicit*/ Function(ReturnType (^objCBlock)(Args... args))
: Function([blockCopy = (ReturnType (^)(Args...))[objCBlock copy]]( : Function([blockCopy = (ReturnType(^)(Args...))[objCBlock copy]](
Args... args) { return blockCopy(args...); }){}; Args... args) { return blockCopy(args...); }){};
#endif #endif
...@@ -680,7 +680,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> { ...@@ -680,7 +680,7 @@ class Function final : private detail::function::FunctionTraits<FunctionType> {
// Make sure Objective C blocks are copied // Make sure Objective C blocks are copied
template <class ReturnType, class... Args> template <class ReturnType, class... Args>
/* implicit */ Function& operator=(ReturnType (^objCBlock)(Args... args)) { /* implicit */ Function& operator=(ReturnType (^objCBlock)(Args... args)) {
(*this) = [blockCopy = (ReturnType (^)(Args...))[objCBlock copy]]( (*this) = [blockCopy = (ReturnType(^)(Args...))[objCBlock copy]](
Args... args) { return blockCopy(args...); }; Args... args) { return blockCopy(args...); };
return *this; return *this;
} }
......
...@@ -333,7 +333,9 @@ template <class T, class I> ...@@ -333,7 +333,9 @@ template <class T, class I>
/// \overload /// \overload
template <class T, class I> template <class T, class I>
[[noreturn]] detail::AddCvrefOf<T, I> const& poly_cast( [[noreturn]] detail::AddCvrefOf<T, I> const& poly_cast(
detail::ArchetypeRoot<I> const&) { assume_unreachable(); } detail::ArchetypeRoot<I> const&) {
assume_unreachable();
}
/// \endcond /// \endcond
/// \overload /// \overload
......
...@@ -152,7 +152,7 @@ namespace { ...@@ -152,7 +152,7 @@ namespace {
// Copy pointers to the given strings in a format suitable for posix_spawn // Copy pointers to the given strings in a format suitable for posix_spawn
std::unique_ptr<const char* []> cloneStrings( std::unique_ptr<const char* []> cloneStrings(
const std::vector<std::string>& s) { const std::vector<std::string>& s) {
std::unique_ptr<const char* []> d(new const char*[s.size() + 1]); std::unique_ptr<const char*[]> d(new const char*[s.size() + 1]);
for (size_t i = 0; i < s.size(); i++) { for (size_t i = 0; i < s.size(); i++) {
d[i] = s[i].c_str(); d[i] = s[i].c_str();
} }
...@@ -247,7 +247,7 @@ void Subprocess::setAllNonBlocking() { ...@@ -247,7 +247,7 @@ void Subprocess::setAllNonBlocking() {
} }
void Subprocess::spawn( void Subprocess::spawn(
std::unique_ptr<const char* []> argv, std::unique_ptr<const char*[]> argv,
const char* executable, const char* executable,
const Options& optionsIn, const Options& optionsIn,
const std::vector<std::string>* env) { const std::vector<std::string>* env) {
...@@ -319,7 +319,7 @@ void Subprocess::spawn( ...@@ -319,7 +319,7 @@ void Subprocess::spawn(
FOLLY_PUSH_WARNING FOLLY_PUSH_WARNING
FOLLY_GCC_DISABLE_WARNING("-Wclobbered") FOLLY_GCC_DISABLE_WARNING("-Wclobbered")
void Subprocess::spawnInternal( void Subprocess::spawnInternal(
std::unique_ptr<const char* []> argv, std::unique_ptr<const char*[]> argv,
const char* executable, const char* executable,
Options& options, Options& options,
const std::vector<std::string>* env, const std::vector<std::string>* env,
...@@ -382,7 +382,7 @@ void Subprocess::spawnInternal( ...@@ -382,7 +382,7 @@ void Subprocess::spawnInternal(
char** argVec = const_cast<char**>(argv.get()); char** argVec = const_cast<char**>(argv.get());
// Set up environment // Set up environment
std::unique_ptr<const char* []> envHolder; std::unique_ptr<const char*[]> envHolder;
char** envVec; char** envVec;
if (env) { if (env) {
envHolder = cloneStrings(*env); envHolder = cloneStrings(*env);
......
...@@ -887,12 +887,12 @@ class Subprocess { ...@@ -887,12 +887,12 @@ class Subprocess {
// spawnInternal() returns it reads the error pipe to see if the child // spawnInternal() returns it reads the error pipe to see if the child
// encountered any errors. // encountered any errors.
void spawn( void spawn(
std::unique_ptr<const char* []> argv, std::unique_ptr<const char*[]> argv,
const char* executable, const char* executable,
const Options& options, const Options& options,
const std::vector<std::string>* env); const std::vector<std::string>* env);
void spawnInternal( void spawnInternal(
std::unique_ptr<const char* []> argv, std::unique_ptr<const char*[]> argv,
const char* executable, const char* executable,
Options& options, Options& options,
const std::vector<std::string>* env, const std::vector<std::string>* env,
......
...@@ -335,10 +335,11 @@ struct ArchetypeBase : Bottom { ...@@ -335,10 +335,11 @@ struct ArchetypeBase : Bottom {
template <class T> template <class T>
/* implicit */ ArchetypeBase(T&&); /* implicit */ ArchetypeBase(T&&);
template <std::size_t, class... As> template <std::size_t, class... As>
[[noreturn]] Bottom _polyCall_(As&&...) const { std::terminate(); } [[noreturn]] Bottom _polyCall_(As&&...) const {
std::terminate();
}
friend bool friend bool operator==(ArchetypeBase const&, ArchetypeBase const&);
operator==(ArchetypeBase const&, ArchetypeBase const&);
friend bool operator!=(ArchetypeBase const&, ArchetypeBase const&); friend bool operator!=(ArchetypeBase const&, ArchetypeBase const&);
friend bool operator<(ArchetypeBase const&, ArchetypeBase const&); friend bool operator<(ArchetypeBase const&, ArchetypeBase const&);
friend bool operator<=(ArchetypeBase const&, ArchetypeBase const&); friend bool operator<=(ArchetypeBase const&, ArchetypeBase const&);
......
...@@ -66,10 +66,10 @@ void moveTopException(StackTraceStack& from, StackTraceStack& to) { ...@@ -66,10 +66,10 @@ void moveTopException(StackTraceStack& from, StackTraceStack& to) {
struct Initializer { struct Initializer {
Initializer() { Initializer() {
registerCxaThrowCallback([]( registerCxaThrowCallback(
void*, std::type_info*, void (*)(void*)) noexcept { [](void*, std::type_info*, void (*)(void*)) noexcept {
addActiveException(); addActiveException();
}); });
registerCxaBeginCatchCallback([](void*) noexcept { registerCxaBeginCatchCallback([](void*) noexcept {
moveTopException(activeExceptions, caughtExceptions); moveTopException(activeExceptions, caughtExceptions);
...@@ -101,9 +101,8 @@ struct Initializer { ...@@ -101,9 +101,8 @@ struct Initializer {
} }
}); });
registerRethrowExceptionCallback([](std::exception_ptr) noexcept { registerRethrowExceptionCallback(
addActiveException(); [](std::exception_ptr) noexcept { addActiveException(); });
});
try { try {
::folly::exception_tracer::installHandlers(); ::folly::exception_tracer::installHandlers();
......
...@@ -499,9 +499,8 @@ TEST(IsNothrowApplicable, Basic) { ...@@ -499,9 +499,8 @@ TEST(IsNothrowApplicable, Basic) {
(folly::is_nothrow_applicable<decltype(f), std::tuple<int>>{})); (folly::is_nothrow_applicable<decltype(f), std::tuple<int>>{}));
} }
{ {
auto f = folly::overload([](int) noexcept {}, [](double) -> double { auto f = folly::overload(
return {}; [](int) noexcept {}, [](double) -> double { return {}; });
});
EXPECT_FALSE( EXPECT_FALSE(
(folly::is_nothrow_applicable<decltype(f), std::tuple<double>>{})); (folly::is_nothrow_applicable<decltype(f), std::tuple<double>>{}));
EXPECT_TRUE((folly::is_nothrow_applicable<decltype(f), std::tuple<int>>{})); EXPECT_TRUE((folly::is_nothrow_applicable<decltype(f), std::tuple<int>>{}));
...@@ -520,9 +519,8 @@ TEST(IsApplicableR, Basic) { ...@@ -520,9 +519,8 @@ TEST(IsApplicableR, Basic) {
(folly::is_applicable_r<double, decltype(f), std::tuple<int>>{})); (folly::is_applicable_r<double, decltype(f), std::tuple<int>>{}));
} }
{ {
auto f = folly::overload([](int) noexcept {}, [](double) -> double { auto f = folly::overload(
return {}; [](int) noexcept {}, [](double) -> double { return {}; });
});
EXPECT_TRUE( EXPECT_TRUE(
(folly::is_applicable_r<float, decltype(f), std::tuple<double>>{})); (folly::is_applicable_r<float, decltype(f), std::tuple<double>>{}));
EXPECT_TRUE((folly::is_applicable_r<void, decltype(f), std::tuple<int>>{})); EXPECT_TRUE((folly::is_applicable_r<void, decltype(f), std::tuple<int>>{}));
...@@ -545,9 +543,8 @@ TEST(IsNothrowApplicableR, Basic) { ...@@ -545,9 +543,8 @@ TEST(IsNothrowApplicableR, Basic) {
is_nothrow_applicable_r<double, decltype(f), std::tuple<int>>{})); is_nothrow_applicable_r<double, decltype(f), std::tuple<int>>{}));
} }
{ {
auto f = folly::overload([](int) noexcept {}, [](double) -> double { auto f = folly::overload(
return {}; [](int) noexcept {}, [](double) -> double { return {}; });
});
EXPECT_FALSE(( EXPECT_FALSE((
folly:: folly::
is_nothrow_applicable_r<float, decltype(f), std::tuple<double>>{})); is_nothrow_applicable_r<float, decltype(f), std::tuple<double>>{}));
......
...@@ -699,7 +699,9 @@ TEST(SemiFuture, MakeSemiFutureFromFutureWithTry) { ...@@ -699,7 +699,9 @@ TEST(SemiFuture, MakeSemiFutureFromFutureWithTry) {
} }
namespace { namespace {
[[noreturn]] void deferHelper(folly::Try<folly::Unit>&&) { throw eggs; } [[noreturn]] void deferHelper(folly::Try<folly::Unit>&&) {
throw eggs;
}
} // namespace } // namespace
TEST(SemiFuture, DeferWithinContinuation) { TEST(SemiFuture, DeferWithinContinuation) {
......
...@@ -243,8 +243,7 @@ TEST(Json, JsonNonAsciiEncoding) { ...@@ -243,8 +243,7 @@ TEST(Json, JsonNonAsciiEncoding) {
// multiple unicode encodings // multiple unicode encodings
EXPECT_EQ( EXPECT_EQ(
folly::json::serialize("\x1f\xe2\x82\xac", opts), folly::json::serialize("\x1f\xe2\x82\xac", opts), R"("\u001f\u20ac")");
R"("\u001f\u20ac")");
EXPECT_EQ( EXPECT_EQ(
folly::json::serialize("\x1f\xc2\xa2\xe2\x82\xac", opts), folly::json::serialize("\x1f\xc2\xa2\xe2\x82\xac", opts),
R"("\u001f\u00a2\u20ac")"); R"("\u001f\u00a2\u20ac")");
......
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