Skip to content

Commit

Permalink
Turn off clang-format for conflicting areas
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorostsa committed Jun 6, 2024
1 parent a8fcd06 commit 6dd8ddd
Show file tree
Hide file tree
Showing 21 changed files with 64 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ namespace hpx::execution::experimental {
// clang-format on
};

// clang-format off
template <typename Env>
friend auto tag_invoke(get_completion_signatures_t,
let_stopped_sender const&,
Env) noexcept -> generate_completion_signatures<Env>;

// clang-format off
template <typename CPO, typename Scheduler_ = Scheduler,
HPX_CONCEPT_REQUIRES_(
!hpx::execution::experimental::is_scheduler_v<Scheduler_> &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ namespace hpx::execution::experimental {
// clang-format on
};

// clang-format off
template <typename Env>
friend auto tag_invoke(get_completion_signatures_t,
let_value_sender const&,
Env) noexcept -> generate_completion_signatures<Env>;

// clang-format off
template <typename CPO, typename Scheduler_ = Scheduler,
HPX_CONCEPT_REQUIRES_(
!hpx::execution::experimental::is_scheduler_v<Scheduler_> &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,13 @@ namespace hpx::execution::experimental {
std::exception_ptr),
hpx::execution::experimental::set_stopped_t()>;

// clang-format off
template <typename Env>
friend auto tag_invoke(
hpx::execution::experimental::get_completion_signatures_t,
run_loop_sender const&,
Env) noexcept -> completion_signatures;
// clang-format on

run_loop& loop;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ namespace hpx::execution::experimental {
static constexpr bool sends_stopped = false;
};

// clang-format off
template <typename Env>
friend auto tag_invoke(get_completion_signatures_t,
schedule_from_sender const&,
Env) -> generate_completion_signatures<Env>;

// clang-format off
template <typename CPO,
HPX_CONCEPT_REQUIRES_(
meta::value<meta::one_of<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ namespace hpx::execution::experimental {
static constexpr bool sends_stopped = true;
};

// clang-format off
template <typename Env>
friend auto tag_invoke(get_completion_signatures_t,
split_sender const&,
Env) -> generate_completion_signatures<Env>;

// clang-format off
template <typename CPO, typename Scheduler_ = Scheduler,
HPX_CONCEPT_REQUIRES_(
hpx::execution::experimental::is_scheduler_v<Scheduler_> &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,12 @@ namespace hpx::execution::experimental {
static constexpr bool sends_stopped = true;
};

// clang-format off
template <typename Env>
friend auto tag_invoke(get_completion_signatures_t,
when_all_sender const&,
Env) noexcept -> generate_completion_signatures<Env>;
// clang-format on

static constexpr std::size_t num_predecessors = sizeof...(Senders);
static_assert(num_predecessors > 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@ namespace hpx::when_all_vector_detail {
static constexpr bool sends_stopped = true;
};

// clang-format off
template <typename Env>
friend auto tag_invoke(
hpx::execution::experimental::get_completion_signatures_t,
when_all_vector_sender_type const&,
Env) noexcept -> generate_completion_signatures<Env>;
// clang-format on
#endif

template <typename Receiver>
Expand Down
2 changes: 1 addition & 1 deletion libs/core/execution/include/hpx/execution/queries/read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ namespace hpx::execution::experimental {
HPX_FORWARD(Receiver, receiver)};
}

// clang-format off
template <typename Tag1>
friend auto tag_invoke(get_completion_signatures_t,
read_sender<Tag1>,
no_env) -> dependent_completion_signatures<no_env>;

// clang-format off
template <typename Env>
friend auto tag_invoke(get_completion_signatures_t, read_sender, Env)
{
Expand Down
8 changes: 8 additions & 0 deletions libs/core/execution/tests/unit/algorithm_execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct execute_example_sender
}
#endif

// clang-format off
template <typename Env>
friend auto tag_invoke(ex::get_completion_signatures_t,
execute_example_sender const&,
Expand All @@ -45,6 +46,7 @@ struct execute_example_sender
{
friend void tag_invoke(ex::start_t, operation_state&) noexcept {};
};
// clang-format on

template <typename R>
friend operation_state tag_invoke(
Expand Down Expand Up @@ -113,17 +115,23 @@ void tag_invoke(ex::execute_t, scheduler_2, F&&)

struct f_struct_1
{
// clang-format off
void operator()() {};
// clang-format on
};

struct f_struct_2
{
// clang-format off
void operator()(int) {};
// clang-format on
};

struct f_struct_3
{
// clang-format off
void operator()(int = 42) {};
// clang-format on
};

void f_fun_1() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,15 +784,18 @@ namespace hpx::execution::experimental {
unique_any_sender& operator=(unique_any_sender const&) = delete;

#ifdef HPX_HAVE_STDEXEC
// TODO: Remove this
using completion_signatures =
hpx::execution::experimental::completion_signatures<
set_value_t(Ts...), set_error_t(std::exception_ptr)>;
#else
// clang-format off
template <typename Env>
friend auto tag_invoke(get_completion_signatures_t,
unique_any_sender const&,
Env) noexcept -> completion_signatures<set_value_t(Ts...),
set_error_t(std::exception_ptr)>;
// clang-format on
#endif

template <typename R>
Expand Down Expand Up @@ -868,14 +871,17 @@ namespace hpx::execution::experimental {
any_sender& operator=(any_sender const&) = default;

#ifdef HPX_HAVE_STDEXEC
// TODO: Remove this
using completion_signatures =
hpx::execution::experimental::completion_signatures<
set_value_t(Ts...), set_error_t(std::exception_ptr)>;
#else
// clang-format off
template <typename Env>
friend auto tag_invoke(get_completion_signatures_t, any_sender const&,
Env) noexcept -> completion_signatures<set_value_t(Ts...),
set_error_t(std::exception_ptr)>;
// clang-format on
#endif

template <typename R>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <utility>

namespace hpx::execution::experimental { namespace detail {
// clang-format off
template <typename CPO, typename Sender>
concept has_completion_scheduler_v = requires(Sender&& s) {
{
Expand All @@ -32,6 +33,7 @@ namespace hpx::execution::experimental { namespace detail {
hpx::execution::experimental::get_env(snd)),
std::forward<Sender>(snd), std::forward<Ts>(ts)...);
};
// clang-format on
}} // namespace hpx::execution::experimental::detail

#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1246,9 +1246,11 @@ namespace hpx::execution::experimental {
return tag_invoke(as_awaitable, HPX_FORWARD(Ty, value), *this);
}

// clang-format off
template <typename T>
friend auto tag_invoke(
get_env_t, env_promise<T> const&) noexcept -> T const&;
// clang-format on
};

struct with_awaitable_senders_base
Expand Down Expand Up @@ -1468,11 +1470,13 @@ namespace hpx::execution::experimental {
}

// Pass through the get_env receiver query
// clang-format off
friend auto tag_invoke(
get_env_t, type const& self) -> env_of_t<Receiver>
{
return get_env(self.rcvr);
}
// clang-format on

Receiver& rcvr;
};
Expand Down Expand Up @@ -1640,7 +1644,7 @@ namespace hpx::execution::experimental {
connect_result_t<sender_type, receiver> op_state_;
};
};
} // namespace detail
} // namespace detail
#endif // HPX_HAVE_CXX20_COROUTINES

/// End definitions from coroutine_utils and sender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ struct callback_receiver
HPX_TEST(false);
};

// clang-format off
template <typename... Ts>
friend auto tag_invoke(hpx::execution::experimental::set_value_t,
callback_receiver&& r,
Expand All @@ -267,6 +268,7 @@ struct callback_receiver
HPX_INVOKE(r.f, std::forward<Ts>(ts)...);
r.set_value_called = true;
}
// clang-format on
};

template <typename F>
Expand Down
5 changes: 4 additions & 1 deletion libs/core/execution_base/tests/include/coroutine_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ inline constexpr bool indirect_stop_token_provider<void> =
template <typename Fn, typename = std::enable_if_t<std::is_invocable_v<Fn>>,
typename = std::enable_if_t<std::is_nothrow_move_constructible_v<Fn> &&
std::is_nothrow_invocable_v<Fn>>>

// clang-format off
struct scope_guard
{
Fn fn_;
Expand All @@ -63,6 +65,7 @@ struct scope_guard
((Fn&&) fn_)();
}
};
// clang-format on

struct forward_stop_request
{
Expand Down Expand Up @@ -405,7 +408,7 @@ class basic_task
}

// Make this task generally awaitable:
friend task_awaitable<> operator co_await(basic_task && self) noexcept
friend task_awaitable<> operator co_await(basic_task&& self) noexcept
{
static_assert(well_formed<awaiter_context_t, _promise>);
return task_awaitable<>{std::exchange(self.coro_, {})};
Expand Down
4 changes: 4 additions & 0 deletions libs/core/execution_base/tests/unit/any_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ struct non_copyable_sender

hpx::tuple<std::decay_t<Ts>...> ts;

// clang-format off
template <typename Env>
friend auto tag_invoke(ex::get_completion_signatures_t,
non_copyable_sender const&,
Env) noexcept -> ex::completion_signatures<ex::set_value_t(Ts...),
ex::set_error_t(std::exception_ptr)>;
// clang-format on

non_copyable_sender() = default;
template <typename T,
Expand Down Expand Up @@ -111,11 +113,13 @@ struct example_sender

using is_sender = void;

// clang-format off
template <typename Env>
friend auto tag_invoke(ex::get_completion_signatures_t,
example_sender const&,
Env) noexcept -> ex::completion_signatures<ex::set_value_t(Ts...),
ex::set_error_t(std::exception_ptr)>;
// clang-format on

example_sender() = default;
template <typename T,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,26 @@
namespace ex = hpx::execution::experimental;

///////////////////////////////////////////////////////////////////////////////
// clang-format off
template <typename... Values>
auto signature_values(
Values...) -> ex::completion_signatures<ex::set_value_t(Values...)>
{
return {};
}
// clang-format on

template <typename Error>
auto signature_error(Error) -> ex::completion_signatures<ex::set_error_t(Error)>
{
return {};
}

// clang-format off
auto signature_stopped() -> ex::completion_signatures<ex::set_stopped_t()>
{
return {};
}
// clang-format on

template <typename Error, typename... Values>
auto signature_error_values(
Expand All @@ -50,12 +53,14 @@ auto signature_values_stopped(
return {};
}

// clang-format off
template <typename Error>
auto signature_error_stopped(Error)
-> ex::completion_signatures<ex::set_error_t(Error), ex::set_stopped_t()>
{
return {};
}
// clang-format on

template <typename Error, typename... Values>
auto signature_all(
Expand Down
4 changes: 4 additions & 0 deletions libs/core/execution_base/tests/unit/get_env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ namespace mylib {
#ifdef HPX_HAVE_STDEXEC
inline constexpr struct receiver_env_t final : ex::forwarding_query_t
{
// clang-format off
template <typename Env>
requires ex::stdexec_non_standard_tag_invoke::tag_invocable<
receiver_env_t, Env>
auto operator()(Env const& e) const
{
return ex::stdexec_non_standard_tag_invoke::tag_invoke(*this, e);
}
// clang-format on
} receiver_env{};
#else
inline constexpr struct receiver_env_t final
Expand Down Expand Up @@ -106,13 +108,15 @@ namespace mylib {
#ifdef HPX_HAVE_STDEXEC
inline constexpr struct receiver_env1_t final : ex::forwarding_query_t
{
// clang-format off
template <typename Env>
requires ex::stdexec_non_standard_tag_invoke::tag_invocable<
receiver_env1_t, Env>
auto operator()(Env const& e) const
{
return ex::stdexec_non_standard_tag_invoke::tag_invoke(*this, e);
}
// clang-format on
} receiver_env1{};
#else
inline constexpr struct receiver_env1_t final
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,13 +733,13 @@ namespace hpx::execution::experimental::detail {
sends_stopped_of_v<Sender, Env>;
};

// clang-format off
template <typename Env>
friend auto tag_invoke(
hpx::execution::experimental::get_completion_signatures_t,
thread_pool_bulk_sender const&,
Env) -> generate_completion_signatures<Env>;

// clang-format off
template <typename CPO,
HPX_CONCEPT_REQUIRES_(
meta::value<meta::one_of<CPO,
Expand Down
Loading

0 comments on commit 6dd8ddd

Please sign in to comment.