[libcxx-commits] [libcxx] [libcxx] applies integer-like changes from [P2393R1] (PR #74161)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 1 16:33:56 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 005c83380a907becbf5a6b4522fc43652c9536cd af3ef3b5fc9c4ac6da0cb6603f7ddfc1097b3300 -- libcxx/include/__ranges/counted.h libcxx/include/__ranges/subrange.h libcxx/include/__ranges/take_view.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__ranges/counted.h b/libcxx/include/__ranges/counted.h
index d7e967c762..ba83543ab4 100644
--- a/libcxx/include/__ranges/counted.h
+++ b/libcxx/include/__ranges/counted.h
@@ -38,12 +38,13 @@ namespace ranges::views {
 namespace __counted {
 
   struct __fn {
-    template<contiguous_iterator _It>
-    _LIBCPP_HIDE_FROM_ABI
-    static constexpr auto __go(_It __it, iter_difference_t<_It> __count)
-      noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(static_cast<iter_difference_t<_It>>(__count)))))
-      // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
-      { return          span(std::to_address(__it), static_cast<size_t>(static_cast<iter_difference_t<_It>>(__count))); }
+    template <contiguous_iterator _It>
+    _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept(
+        noexcept(span(std::to_address(__it), static_cast<size_t>(static_cast<iter_difference_t<_It>>(__count)))))
+    // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
+    {
+      return span(std::to_address(__it), static_cast<size_t>(static_cast<iter_difference_t<_It>>(__count)));
+    }
 
     template<random_access_iterator _It>
     _LIBCPP_HIDE_FROM_ABI
diff --git a/libcxx/include/__ranges/subrange.h b/libcxx/include/__ranges/subrange.h
index 0413f18216..1bc41a75e2 100644
--- a/libcxx/include/__ranges/subrange.h
+++ b/libcxx/include/__ranges/subrange.h
@@ -122,15 +122,12 @@ namespace ranges {
       : subrange(ranges::begin(__range), ranges::end(__range))
     { }
 
-    template<__different_from<subrange> _Range>
-      requires borrowed_range<_Range> &&
-               __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
+    template <__different_from<subrange> _Range>
+      requires borrowed_range<_Range> && __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
                convertible_to<sentinel_t<_Range>, _Sent>
-    _LIBCPP_HIDE_FROM_ABI
-    constexpr subrange(_Range&& __range)
-      requires _StoreSize && sized_range<_Range>
-      : subrange(__range, static_cast<decltype(__size_)>(ranges::size(__range)))
-    { }
+               _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range)
+                 requires _StoreSize && sized_range<_Range>
+        : subrange(__range, static_cast<decltype(__size_)>(ranges::size(__range))) {}
 
     template<borrowed_range _Range>
       requires __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
diff --git a/libcxx/include/__ranges/take_view.h b/libcxx/include/__ranges/take_view.h
index 5331a0e384..92f0c5faf3 100644
--- a/libcxx/include/__ranges/take_view.h
+++ b/libcxx/include/__ranges/take_view.h
@@ -87,7 +87,7 @@ public:
         return ranges::begin(__base_);
       } else {
         using _DifferenceT = range_difference_t<_View>;
-        auto __size = range_difference_t<_View>(size());
+        auto __size        = range_difference_t<_View>(size());
         return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
       }
     } else {
@@ -102,7 +102,7 @@ public:
         return ranges::begin(__base_);
       } else {
         using _DifferenceT = range_difference_t<const _View>;
-        auto __size = range_difference_t<_View>(size());
+        auto __size        = range_difference_t<_View>(size());
         return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
       }
     } else {

``````````

</details>


https://github.com/llvm/llvm-project/pull/74161


More information about the libcxx-commits mailing list