[libcxx-commits] [libcxx] [libc++] Remove assumptions that std::array::iterator is a raw pointer (PR #74624)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 6 08:41:30 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 8186e1500b1d9709f10199b7c599274f8a6f8e3a 860b13e4b55689a7acb2b50f83eb32ef2d59b384 -- libcxx/include/__format/buffer.h libcxx/include/__format/formatter_integral.h libcxx/include/__format/formatter_output.h libcxx/test/libcxx/input.output/iostream.format/print.fun/transcoding.pass.cpp libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp libcxx/test/std/containers/sequences/array/types.pass.cpp libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.pass.cpp libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__format/formatter_integral.h b/libcxx/include/__format/formatter_integral.h
index 93a41f9417..3c54e5edf9 100644
--- a/libcxx/include/__format/formatter_integral.h
+++ b/libcxx/include/__format/formatter_integral.h
@@ -208,9 +208,14 @@ consteval size_t __buffer_size() noexcept
 }
 
 template <class _OutIt, contiguous_iterator _Iterator, class _CharT>
-_LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, _Iterator __begin, _Iterator __first,
-                                                              _Iterator __last, string&& __grouping, _CharT __sep,
-                                                              __format_spec::__parsed_specifications<_CharT> __specs) {
+_LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(
+    _OutIt __out_it,
+    _Iterator __begin,
+    _Iterator __first,
+    _Iterator __last,
+    string&& __grouping,
+    _CharT __sep,
+    __format_spec::__parsed_specifications<_CharT> __specs) {
   int __size = (__first - __begin) +    // [sign][prefix]
                (__last - __first) +     // data
                (__grouping.size() - 1); // number of separator characters
@@ -271,8 +276,6 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, _
   return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
 }
 
-
-
 template <unsigned_integral _Tp, contiguous_iterator _Iterator, class _CharT, class _FormatContext>
 _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
     _Tp __value,
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index 6c7892d869..9496a82485 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -134,11 +134,9 @@ template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT,
           class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto
-__transform(_Iterator __first,
-            _Iterator __last,
-            output_iterator<const _OutCharT&> auto __out_it,
-            _UnaryOperation __operation) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto __transform(
+    _Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it, _UnaryOperation __operation)
+    -> decltype(__out_it) {
   if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
     __out_it.__get_container()->__transform(__first, __last, std::move(__operation));
     return __out_it;
@@ -271,10 +269,12 @@ template <contiguous_iterator _Iterator,
           class _CharT = typename iterator_traits<_Iterator>::value_type,
           class _ParserCharT,
           class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto __write_transformed(_Iterator __first, _Iterator __last,
-                                               output_iterator<const _CharT&> auto __out_it,
-                                               __format_spec::__parsed_specifications<_ParserCharT> __specs,
-                                               _UnaryOperation __op) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto __write_transformed(
+    _Iterator __first,
+    _Iterator __last,
+    output_iterator<const _CharT&> auto __out_it,
+    __format_spec::__parsed_specifications<_ParserCharT> __specs,
+    _UnaryOperation __op) -> decltype(__out_it) {
   _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range");
 
   ptrdiff_t __size = __last - __first;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
index 2df7834477..498efd79a7 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
@@ -86,9 +86,10 @@ template <class CharT, class ArithmeticT>
 void test_hex_lower_case_precision(ArithmeticT value) {
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::hex, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::hex, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     test_termination_condition(STR(".20000a}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
     std::size_t unused = buffer.end() - end;
@@ -100,7 +101,7 @@ void test_hex_lower_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000a}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000a}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -109,9 +110,10 @@ void test_hex_lower_case_precision(ArithmeticT value) {
 #ifndef TEST_HAS_NO_LOCALIZATION
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::hex, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::hex, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     test_termination_condition(STR(".20000La}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
     std::size_t unused = buffer.end() - end;
@@ -123,7 +125,7 @@ void test_hex_lower_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000La}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000La}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -135,9 +137,10 @@ template <class CharT, class ArithmeticT>
 void test_hex_upper_case_precision(ArithmeticT value) {
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::hex, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::hex, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     std::transform(buffer.begin(), end, buffer.begin(), [](char c) { return std::toupper(c); });
     test_termination_condition(STR(".20000A}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
@@ -150,7 +153,7 @@ void test_hex_upper_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000A}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000A}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -159,9 +162,10 @@ void test_hex_upper_case_precision(ArithmeticT value) {
 #ifndef TEST_HAS_NO_LOCALIZATION
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::hex, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::hex, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     std::transform(buffer.begin(), end, buffer.begin(), [](char c) { return std::toupper(c); });
     test_termination_condition(STR(".20000LA}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
@@ -174,7 +178,7 @@ void test_hex_upper_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000LA}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000LA}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -186,9 +190,10 @@ template <class CharT, class ArithmeticT>
 void test_scientific_lower_case_precision(ArithmeticT value) {
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::scientific, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::scientific, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     test_termination_condition(STR(".20000e}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
     std::size_t unused = buffer.end() - end;
@@ -200,7 +205,7 @@ void test_scientific_lower_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000e}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000e}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -209,9 +214,10 @@ void test_scientific_lower_case_precision(ArithmeticT value) {
 #ifndef TEST_HAS_NO_LOCALIZATION
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::scientific, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::scientific, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     test_termination_condition(STR(".20000Le}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
     std::size_t unused = buffer.end() - end;
@@ -223,7 +229,7 @@ void test_scientific_lower_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000Le}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000Le}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -235,9 +241,10 @@ template <class CharT, class ArithmeticT>
 void test_scientific_upper_case_precision(ArithmeticT value) {
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::scientific, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::scientific, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     std::transform(buffer.begin(), end, buffer.begin(), [](char c) { return std::toupper(c); });
     test_termination_condition(STR(".20000E}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
@@ -250,7 +257,7 @@ void test_scientific_upper_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000E}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000E}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -259,9 +266,10 @@ void test_scientific_upper_case_precision(ArithmeticT value) {
 #ifndef TEST_HAS_NO_LOCALIZATION
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::scientific, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::scientific, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     std::transform(buffer.begin(), end, buffer.begin(), [](char c) { return std::toupper(c); });
     test_termination_condition(STR(".20000LE}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
@@ -274,7 +282,7 @@ void test_scientific_upper_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000LE}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000LE}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -286,9 +294,10 @@ template <class CharT, class ArithmeticT>
 void test_fixed_lower_case_precision(ArithmeticT value) {
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::fixed, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::fixed, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     test_termination_condition(STR(".20000f}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
     std::size_t unused = buffer.end() - end;
@@ -300,7 +309,7 @@ void test_fixed_lower_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000f}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000f}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -309,9 +318,10 @@ void test_fixed_lower_case_precision(ArithmeticT value) {
 #ifndef TEST_HAS_NO_LOCALIZATION
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::fixed, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::fixed, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     test_termination_condition(STR(".20000Lf}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
     std::size_t unused = buffer.end() - end;
@@ -323,7 +333,7 @@ void test_fixed_lower_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000Lf}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000Lf}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -335,9 +345,10 @@ template <class CharT, class ArithmeticT>
 void test_fixed_upper_case_precision(ArithmeticT value) {
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::fixed, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::fixed, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     std::transform(buffer.begin(), end, buffer.begin(), [](char c) { return std::toupper(c); });
     test_termination_condition(STR(".20000F}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
@@ -350,7 +361,7 @@ void test_fixed_upper_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000F}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000F}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -359,9 +370,10 @@ void test_fixed_upper_case_precision(ArithmeticT value) {
 #ifndef TEST_HAS_NO_LOCALIZATION
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::fixed, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::fixed, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     std::transform(buffer.begin(), end, buffer.begin(), [](char c) { return std::toupper(c); });
     test_termination_condition(STR(".20000LF}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
@@ -374,7 +386,7 @@ void test_fixed_upper_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000LF}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000LF}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -386,9 +398,10 @@ template <class CharT, class ArithmeticT>
 void test_general_lower_case_precision(ArithmeticT value) {
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::general, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::general, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     test_termination_condition(STR(".20000g}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
     std::size_t unused = buffer.end() - end;
@@ -400,7 +413,7 @@ void test_general_lower_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000g}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000g}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -409,9 +422,10 @@ void test_general_lower_case_precision(ArithmeticT value) {
 #ifndef TEST_HAS_NO_LOCALIZATION
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::general, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::general, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     test_termination_condition(STR(".20000Lg}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
     std::size_t unused = buffer.end() - end;
@@ -423,7 +437,7 @@ void test_general_lower_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000Lg}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000Lg}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -435,9 +449,10 @@ template <class CharT, class ArithmeticT>
 void test_general_upper_case_precision(ArithmeticT value) {
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::general, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::general, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     std::transform(buffer.begin(), end, buffer.begin(), [](char c) { return std::toupper(c); });
     test_termination_condition(STR(".20000G}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
@@ -450,7 +465,7 @@ void test_general_upper_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000G}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000G}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
@@ -459,9 +474,10 @@ void test_general_upper_case_precision(ArithmeticT value) {
 #ifndef TEST_HAS_NO_LOCALIZATION
   {
     std::array<char, 25'000> buffer;
-    char* end_ptr = std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::general, 20'000).ptr;
+    char* end_ptr =
+        std::to_chars(buffer.data(), buffer.data() + buffer.size(), value, std::chars_format::general, 20'000).ptr;
     std::size_t size = end_ptr - buffer.data();
-    auto end = buffer.begin() + size;
+    auto end         = buffer.begin() + size;
     std::transform(buffer.begin(), end, buffer.begin(), [](char c) { return std::toupper(c); });
     test_termination_condition(STR(".20000LG}"), value, std::basic_string<CharT>{buffer.begin(), end});
 
@@ -474,7 +490,7 @@ void test_general_upper_case_precision(ArithmeticT value) {
     test_termination_condition(STR("#>25000.20000LG}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
     std::fill_n(buffer.begin(), unused, '0');
     if (std::signbit(value)) {
-      buffer[0] = '-';
+      buffer[0]      = '-';
       buffer[unused] = '0';
     }
     test_termination_condition(STR("025000.20000LG}"), value, std::basic_string<CharT>{buffer.begin(), buffer.end()});
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
index ff5bfe0fb4..3a957a1995 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
@@ -58,8 +58,9 @@ void test(StringT expected, StringViewT fmt, PointerT arg, std::size_t offset) {
     std::array<char, 128> buffer;
     buffer[0] = CharT('0');
     buffer[1] = CharT('x');
-    expected.append(buffer.data(),
-                    std::to_chars(buffer.data() + 2, buffer.data() + buffer.size(), reinterpret_cast<std::uintptr_t>(arg), 16).ptr);
+    expected.append(
+        buffer.data(),
+        std::to_chars(buffer.data() + 2, buffer.data() + buffer.size(), reinterpret_cast<std::uintptr_t>(arg), 16).ptr);
   }
   assert(result == expected);
 }

``````````

</details>


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


More information about the libcxx-commits mailing list