[libcxx-commits] [libcxx] [libc++] Remove _LIBCPP_AUTO_CAST (PR #66027)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 24 04:07:05 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 6bdeb53ed9ad85fc16f495120b4e2382c4bdaafa 5439c0f6b64572b132e36fe004a56833eb9ed3c6 -- libcxx/include/__ranges/access.h libcxx/include/__ranges/all.h libcxx/include/__ranges/data.h libcxx/include/__ranges/drop_view.h libcxx/include/__ranges/rbegin.h libcxx/include/__ranges/rend.h libcxx/include/__ranges/size.h libcxx/include/__ranges/take_view.h libcxx/include/future libcxx/include/string libcxx/include/utility
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__ranges/access.h b/libcxx/include/__ranges/access.h
index 205ac934aa..be65003981 100644
--- a/libcxx/include/__ranges/access.h
+++ b/libcxx/include/__ranges/access.h
@@ -40,58 +40,48 @@ namespace ranges {
namespace ranges {
namespace __begin {
- template <class _Tp>
- concept __member_begin =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { auto(__t.begin()) } -> input_or_output_iterator;
- };
+template <class _Tp>
+concept __member_begin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { auto(__t.begin()) } -> input_or_output_iterator;
+};
- void begin(auto&) = delete;
- void begin(const auto&) = delete;
+void begin(auto&) = delete;
+void begin(const auto&) = delete;
- template <class _Tp>
- concept __unqualified_begin =
- !__member_begin<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp && __t) {
+template <class _Tp>
+concept __unqualified_begin =
+ !__member_begin<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
{ auto(begin(__t)) } -> input_or_output_iterator;
};
- struct __fn {
- template <class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[]) const noexcept
- requires (sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + 0;
- }
-
- template <class _Tp, size_t _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
- requires (sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + 0;
- }
+struct __fn {
+ template <class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[]) const noexcept
+ requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
+ {
+ return __t + 0;
+ }
+
+ template <class _Tp, size_t _Np>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
+ requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
+ {
+ return __t + 0;
+ }
- template <class _Tp>
- requires __member_begin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(auto(__t.begin())))
- {
- return auto(__t.begin());
- }
+ template <class _Tp>
+ requires __member_begin<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(auto(__t.begin()))) {
+ return auto(__t.begin());
+ }
- template <class _Tp>
- requires __unqualified_begin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(auto(begin(__t))))
- {
- return auto(begin(__t));
- }
+ template <class _Tp>
+ requires __unqualified_begin<_Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(auto(begin(__t)))) {
+ return auto(begin(__t));
+ }
- void operator()(auto&&) const = delete;
+ void operator()(auto&&) const = delete;
};
} // namespace __begin
@@ -143,17 +133,13 @@ namespace __end {
template <class _Tp>
requires __member_end<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(auto(__t.end())))
- {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(auto(__t.end()))) {
return auto(__t.end());
}
template <class _Tp>
requires __unqualified_end<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(auto(end(__t))))
- {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(auto(end(__t)))) {
return auto(end(__t));
}
diff --git a/libcxx/include/__ranges/all.h b/libcxx/include/__ranges/all.h
index 867b8c3a6a..17f20fb684 100644
--- a/libcxx/include/__ranges/all.h
+++ b/libcxx/include/__ranges/all.h
@@ -36,13 +36,10 @@ namespace ranges::views {
namespace __all {
struct __fn : __range_adaptor_closure<__fn> {
- template<class _Tp>
+ template <class _Tp>
requires ranges::view<decay_t<_Tp>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(auto(std::forward<_Tp>(__t))))
- -> decltype(auto(std::forward<_Tp>(__t)))
- {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
+ noexcept(noexcept(auto(std::forward<_Tp>(__t)))) -> decltype(auto(std::forward<_Tp>(__t))) {
return auto(std::forward<_Tp>(__t));
}
diff --git a/libcxx/include/__ranges/data.h b/libcxx/include/__ranges/data.h
index d37c040e76..291b778946 100644
--- a/libcxx/include/__ranges/data.h
+++ b/libcxx/include/__ranges/data.h
@@ -39,12 +39,9 @@ namespace __data {
concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>;
template <class _Tp>
- concept __member_data =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { auto(__t.data()) } -> __ptr_to_object;
- };
+ concept __member_data = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { auto(__t.data()) } -> __ptr_to_object;
+ };
template <class _Tp>
concept __ranges_begin_invocable =
diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h
index a220fc1bbd..55a3e40593 100644
--- a/libcxx/include/__ranges/drop_view.h
+++ b/libcxx/include/__ranges/drop_view.h
@@ -202,11 +202,10 @@ struct __fn {
// [range.drop.overview]: the `empty_view` case.
template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
requires __is_empty_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&&) const
- noexcept(noexcept(auto(std::forward<_Range>(__range))))
- -> decltype( auto(std::forward<_Range>(__range)))
- { return auto(std::forward<_Range>(__range)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const
+ noexcept(noexcept(auto(std::forward<_Range>(__range)))) -> decltype(auto(std::forward<_Range>(__range))) {
+ return auto(std::forward<_Range>(__range));
+ }
// [range.drop.overview]: the `span | basic_string_view | iota_view | subrange (StoreSize == false)` case.
template <class _Range,
diff --git a/libcxx/include/__ranges/rbegin.h b/libcxx/include/__ranges/rbegin.h
index 71eb5000a8..1d6a3462fc 100644
--- a/libcxx/include/__ranges/rbegin.h
+++ b/libcxx/include/__ranges/rbegin.h
@@ -35,24 +35,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __rbegin {
template <class _Tp>
-concept __member_rbegin =
- __can_borrow<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { auto(__t.rbegin()) } -> input_or_output_iterator;
- };
+concept __member_rbegin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { auto(__t.rbegin()) } -> input_or_output_iterator;
+};
void rbegin(auto&) = delete;
void rbegin(const auto&) = delete;
template <class _Tp>
concept __unqualified_rbegin =
- !__member_rbegin<_Tp> &&
- __can_borrow<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- { auto(rbegin(__t)) } -> input_or_output_iterator;
- };
+ !__member_rbegin<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ { auto(rbegin(__t)) } -> input_or_output_iterator;
+ };
template <class _Tp>
concept __can_reverse =
@@ -68,16 +62,13 @@ struct __fn {
template <class _Tp>
requires __member_rbegin<_Tp>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(auto(__t.rbegin())))
- {
+ noexcept(noexcept(auto(__t.rbegin()))) {
return auto(__t.rbegin());
}
template <class _Tp>
requires __unqualified_rbegin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(auto(rbegin(__t))))
- {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(auto(rbegin(__t)))) {
return auto(rbegin(__t));
}
diff --git a/libcxx/include/__ranges/rend.h b/libcxx/include/__ranges/rend.h
index f501021fcf..0d3fda8e28 100644
--- a/libcxx/include/__ranges/rend.h
+++ b/libcxx/include/__ranges/rend.h
@@ -71,17 +71,13 @@ class __fn {
public:
template <class _Tp>
requires __member_rend<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(auto(__t.rend())))
- {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(auto(__t.rend()))) {
return auto(__t.rend());
}
template <class _Tp>
requires __unqualified_rend<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(auto(rend(__t))))
- {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(auto(rend(__t)))) {
return auto(rend(__t));
}
diff --git a/libcxx/include/__ranges/size.h b/libcxx/include/__ranges/size.h
index 0a84e1cf8f..9a94da2d29 100644
--- a/libcxx/include/__ranges/size.h
+++ b/libcxx/include/__ranges/size.h
@@ -47,21 +47,15 @@ template <class _Tp>
concept __size_enabled = !disable_sized_range<remove_cvref_t<_Tp>>;
template <class _Tp>
-concept __member_size =
- __size_enabled<_Tp> &&
- __workaround_52970<_Tp> &&
- requires(_Tp&& __t) {
- { auto(__t.size()) } -> __integer_like;
- };
+concept __member_size = __size_enabled<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
+ { auto(__t.size()) } -> __integer_like;
+};
template <class _Tp>
concept __unqualified_size =
- __size_enabled<_Tp> &&
- !__member_size<_Tp> &&
- __class_or_enum<remove_cvref_t<_Tp>> &&
- requires(_Tp&& __t) {
- { auto(size(__t)) } -> __integer_like;
- };
+ __size_enabled<_Tp> && !__member_size<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
+ { auto(size(__t)) } -> __integer_like;
+ };
template <class _Tp>
concept __difference =
diff --git a/libcxx/include/__ranges/take_view.h b/libcxx/include/__ranges/take_view.h
index 3f51bc6225..a77f6a27de 100644
--- a/libcxx/include/__ranges/take_view.h
+++ b/libcxx/include/__ranges/take_view.h
@@ -246,11 +246,10 @@ struct __fn {
// [range.take.overview]: the `empty_view` case.
template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
requires __is_empty_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&&) const
- noexcept(noexcept(auto(std::forward<_Range>(__range))))
- -> decltype( auto(std::forward<_Range>(__range)))
- { return auto(std::forward<_Range>(__range)); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const
+ noexcept(noexcept(auto(std::forward<_Range>(__range)))) -> decltype(auto(std::forward<_Range>(__range))) {
+ return auto(std::forward<_Range>(__range));
+ }
// [range.take.overview]: the `span | basic_string_view | subrange` case.
template <class _Range,
``````````
</details>
https://github.com/llvm/llvm-project/pull/66027
More information about the libcxx-commits
mailing list