-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[libc++] Format the code base #74334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) ChangesThis patch runs clang-format on all of libcxx/include and libcxx/src, in accordance with the RFC discussed at 1. Follow-up patches will format the benchmarks, the test suite and remaining parts of the code. I'm splitting this one into its own patch so the diff is a bit easier to review. This patch was generated with: find libcxx/include libcxx/src -type f | grep -v 'module.modulemap.in' | grep -v 'CMakeLists.txt' | grep -v 'README.txt' | xargs clang-format -i Patch is 7.62 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/74334.diff 549 Files Affected:
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000000..6b281f33f737d
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,142 @@
+libcxx/src/**/*.cpp merge=libcxx-reformat
+libcxx/include/**/*.h merge=libcxx-reformat
+
+# Explicitly handle files with no extension
+libcxx/include/__availability merge=libcxx-reformat
+libcxx/include/__bit_reference merge=libcxx-reformat
+libcxx/include/__config merge=libcxx-reformat
+libcxx/include/__hash_table merge=libcxx-reformat
+libcxx/include/__locale merge=libcxx-reformat
+libcxx/include/__node_handle merge=libcxx-reformat
+libcxx/include/__split_buffer merge=libcxx-reformat
+libcxx/include/__std_clang_module merge=libcxx-reformat
+libcxx/include/__threading_support merge=libcxx-reformat
+libcxx/include/__tree merge=libcxx-reformat
+libcxx/include/__verbose_abort merge=libcxx-reformat
+libcxx/include/algorithm merge=libcxx-reformat
+libcxx/include/any merge=libcxx-reformat
+libcxx/include/array merge=libcxx-reformat
+libcxx/include/atomic merge=libcxx-reformat
+libcxx/include/barrier merge=libcxx-reformat
+libcxx/include/bit merge=libcxx-reformat
+libcxx/include/bitset merge=libcxx-reformat
+libcxx/include/cassert merge=libcxx-reformat
+libcxx/include/ccomplex merge=libcxx-reformat
+libcxx/include/cctype merge=libcxx-reformat
+libcxx/include/cerrno merge=libcxx-reformat
+libcxx/include/cfenv merge=libcxx-reformat
+libcxx/include/cfloat merge=libcxx-reformat
+libcxx/include/charconv merge=libcxx-reformat
+libcxx/include/chrono merge=libcxx-reformat
+libcxx/include/cinttypes merge=libcxx-reformat
+libcxx/include/ciso646 merge=libcxx-reformat
+libcxx/include/climits merge=libcxx-reformat
+libcxx/include/clocale merge=libcxx-reformat
+libcxx/include/cmath merge=libcxx-reformat
+libcxx/include/codecvt merge=libcxx-reformat
+libcxx/include/compare merge=libcxx-reformat
+libcxx/include/complex merge=libcxx-reformat
+libcxx/include/concepts merge=libcxx-reformat
+libcxx/include/condition_variable merge=libcxx-reformat
+libcxx/include/coroutine merge=libcxx-reformat
+libcxx/include/csetjmp merge=libcxx-reformat
+libcxx/include/csignal merge=libcxx-reformat
+libcxx/include/cstdarg merge=libcxx-reformat
+libcxx/include/cstdbool merge=libcxx-reformat
+libcxx/include/cstddef merge=libcxx-reformat
+libcxx/include/cstdint merge=libcxx-reformat
+libcxx/include/cstdio merge=libcxx-reformat
+libcxx/include/cstdlib merge=libcxx-reformat
+libcxx/include/cstring merge=libcxx-reformat
+libcxx/include/ctgmath merge=libcxx-reformat
+libcxx/include/ctime merge=libcxx-reformat
+libcxx/include/cuchar merge=libcxx-reformat
+libcxx/include/cwchar merge=libcxx-reformat
+libcxx/include/cwctype merge=libcxx-reformat
+libcxx/include/deque merge=libcxx-reformat
+libcxx/include/exception merge=libcxx-reformat
+libcxx/include/execution merge=libcxx-reformat
+libcxx/include/expected merge=libcxx-reformat
+libcxx/include/experimental/__config merge=libcxx-reformat
+libcxx/include/experimental/__memory merge=libcxx-reformat
+libcxx/include/experimental/deque merge=libcxx-reformat
+libcxx/include/experimental/forward_list merge=libcxx-reformat
+libcxx/include/experimental/iterator merge=libcxx-reformat
+libcxx/include/experimental/list merge=libcxx-reformat
+libcxx/include/experimental/map merge=libcxx-reformat
+libcxx/include/experimental/memory merge=libcxx-reformat
+libcxx/include/experimental/memory_resource merge=libcxx-reformat
+libcxx/include/experimental/propagate_const merge=libcxx-reformat
+libcxx/include/experimental/regex merge=libcxx-reformat
+libcxx/include/experimental/set merge=libcxx-reformat
+libcxx/include/experimental/simd merge=libcxx-reformat
+libcxx/include/experimental/string merge=libcxx-reformat
+libcxx/include/experimental/type_traits merge=libcxx-reformat
+libcxx/include/experimental/unordered_map merge=libcxx-reformat
+libcxx/include/experimental/unordered_set merge=libcxx-reformat
+libcxx/include/experimental/utility merge=libcxx-reformat
+libcxx/include/experimental/vector merge=libcxx-reformat
+libcxx/include/ext/__hash merge=libcxx-reformat
+libcxx/include/ext/hash_map merge=libcxx-reformat
+libcxx/include/ext/hash_set merge=libcxx-reformat
+libcxx/include/filesystem merge=libcxx-reformat
+libcxx/include/format merge=libcxx-reformat
+libcxx/include/forward_list merge=libcxx-reformat
+libcxx/include/fstream merge=libcxx-reformat
+libcxx/include/functional merge=libcxx-reformat
+libcxx/include/future merge=libcxx-reformat
+libcxx/include/initializer_list merge=libcxx-reformat
+libcxx/include/iomanip merge=libcxx-reformat
+libcxx/include/ios merge=libcxx-reformat
+libcxx/include/iosfwd merge=libcxx-reformat
+libcxx/include/iostream merge=libcxx-reformat
+libcxx/include/istream merge=libcxx-reformat
+libcxx/include/iterator merge=libcxx-reformat
+libcxx/include/latch merge=libcxx-reformat
+libcxx/include/limits merge=libcxx-reformat
+libcxx/include/list merge=libcxx-reformat
+libcxx/include/locale merge=libcxx-reformat
+libcxx/include/map merge=libcxx-reformat
+libcxx/include/mdspan merge=libcxx-reformat
+libcxx/include/memory merge=libcxx-reformat
+libcxx/include/memory_resource merge=libcxx-reformat
+libcxx/include/mutex merge=libcxx-reformat
+libcxx/include/new merge=libcxx-reformat
+libcxx/include/numbers merge=libcxx-reformat
+libcxx/include/numeric merge=libcxx-reformat
+libcxx/include/optional merge=libcxx-reformat
+libcxx/include/ostream merge=libcxx-reformat
+libcxx/include/print merge=libcxx-reformat
+libcxx/include/queue merge=libcxx-reformat
+libcxx/include/random merge=libcxx-reformat
+libcxx/include/ranges merge=libcxx-reformat
+libcxx/include/ratio merge=libcxx-reformat
+libcxx/include/regex merge=libcxx-reformat
+libcxx/include/scoped_allocator merge=libcxx-reformat
+libcxx/include/semaphore merge=libcxx-reformat
+libcxx/include/set merge=libcxx-reformat
+libcxx/include/shared_mutex merge=libcxx-reformat
+libcxx/include/source_location merge=libcxx-reformat
+libcxx/include/span merge=libcxx-reformat
+libcxx/include/sstream merge=libcxx-reformat
+libcxx/include/stack merge=libcxx-reformat
+libcxx/include/stdexcept merge=libcxx-reformat
+libcxx/include/stop_token merge=libcxx-reformat
+libcxx/include/streambuf merge=libcxx-reformat
+libcxx/include/string merge=libcxx-reformat
+libcxx/include/string_view merge=libcxx-reformat
+libcxx/include/strstream merge=libcxx-reformat
+libcxx/include/syncstream merge=libcxx-reformat
+libcxx/include/system_error merge=libcxx-reformat
+libcxx/include/thread merge=libcxx-reformat
+libcxx/include/tuple merge=libcxx-reformat
+libcxx/include/type_traits merge=libcxx-reformat
+libcxx/include/typeindex merge=libcxx-reformat
+libcxx/include/typeinfo merge=libcxx-reformat
+libcxx/include/unordered_map merge=libcxx-reformat
+libcxx/include/unordered_set merge=libcxx-reformat
+libcxx/include/utility merge=libcxx-reformat
+libcxx/include/valarray merge=libcxx-reformat
+libcxx/include/variant merge=libcxx-reformat
+libcxx/include/vector merge=libcxx-reformat
+libcxx/include/version merge=libcxx-reformat
diff --git a/libcxx/include/__algorithm/binary_search.h b/libcxx/include/__algorithm/binary_search.h
index 5a1d49f5f43e2..7a77d7b5447bd 100644
--- a/libcxx/include/__algorithm/binary_search.h
+++ b/libcxx/include/__algorithm/binary_search.h
@@ -22,22 +22,16 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ForwardIterator, class _Tp, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
-{
- __first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
- return __first != __last && !__comp(__value, *__first);
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
+ __first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
+ return __first != __last && !__comp(__value, *__first);
}
template <class _ForwardIterator, class _Tp>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-bool
-binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
-{
- return std::binary_search(__first, __last, __value, __less<>());
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+ return std::binary_search(__first, __last, __value, __less<>());
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__algorithm/comp_ref_type.h b/libcxx/include/__algorithm/comp_ref_type.h
index 2797e9da66585..15f4a535a30bf 100644
--- a/libcxx/include/__algorithm/comp_ref_type.h
+++ b/libcxx/include/__algorithm/comp_ref_type.h
@@ -20,52 +20,42 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare>
-struct __debug_less
-{
- _Compare &__comp_;
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}
+struct __debug_less {
+ _Compare& __comp_;
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}
- template <class _Tp, class _Up>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(const _Tp& __x, const _Up& __y)
- {
- bool __r = __comp_(__x, __y);
- if (__r)
- __do_compare_assert(0, __y, __x);
- return __r;
- }
+ template <class _Tp, class _Up>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Up& __y) {
+ bool __r = __comp_(__x, __y);
+ if (__r)
+ __do_compare_assert(0, __y, __x);
+ return __r;
+ }
- template <class _Tp, class _Up>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
- bool operator()(_Tp& __x, _Up& __y)
- {
- bool __r = __comp_(__x, __y);
- if (__r)
- __do_compare_assert(0, __y, __x);
- return __r;
- }
+ template <class _Tp, class _Up>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(_Tp& __x, _Up& __y) {
+ bool __r = __comp_(__x, __y);
+ if (__r)
+ __do_compare_assert(0, __y, __x);
+ return __r;
+ }
- template <class _LHS, class _RHS>
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- inline _LIBCPP_HIDE_FROM_ABI
- decltype((void)std::declval<_Compare&>()(
- std::declval<_LHS &>(), std::declval<_RHS &>()))
- __do_compare_assert(int, _LHS & __l, _RHS & __r) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__comp_(__l, __r),
- "Comparator does not induce a strict weak ordering");
- (void)__l;
- (void)__r;
- }
+ template <class _LHS, class _RHS>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI decltype((void)std::declval<_Compare&>()(
+ std::declval<_LHS&>(), std::declval<_RHS&>()))
+ __do_compare_assert(int, _LHS& __l, _RHS& __r) {
+ _LIBCPP_ASSERT_UNCATEGORIZED(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering");
+ (void)__l;
+ (void)__r;
+ }
- template <class _LHS, class _RHS>
- _LIBCPP_CONSTEXPR_SINCE_CXX14
- inline _LIBCPP_HIDE_FROM_ABI
- void __do_compare_assert(long, _LHS &, _RHS &) {}
+ template <class _LHS, class _RHS>
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI void __do_compare_assert(long, _LHS&, _RHS&) {}
};
// Pass the comparator by lvalue reference. Or in debug mode, using a
// debugging wrapper that stores a reference.
-# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
+#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
template <class _Comp>
using __comp_ref_type = __debug_less<_Comp>;
#else
diff --git a/libcxx/include/__algorithm/copy_backward.h b/libcxx/include/__algorithm/copy_backward.h
index d85d297b3226c..3ec88d8bd5cc3 100644
--- a/libcxx/include/__algorithm/copy_backward.h
+++ b/libcxx/include/__algorithm/copy_backward.h
@@ -108,8 +108,7 @@ struct __copy_backward_loop {
struct __copy_backward_trivial {
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
- template <class _In, class _Out,
- __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
+ template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
operator()(_In* __first, _In* __last, _Out* __result) const {
return std::__copy_backward_trivial_impl(__first, __last, __result);
@@ -124,16 +123,13 @@ __copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _Bidirectiona
}
template <class _BidirectionalIterator1, class _BidirectionalIterator2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_BidirectionalIterator2
-copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
- _BidirectionalIterator2 __result)
-{
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2
+copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) {
static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
- std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible.");
+ std::is_copy_constructible<_BidirectionalIterator1>::value,
+ "Iterators must be copy constructible.");
- return std::__copy_backward<_ClassicAlgPolicy>(
- std::move(__first), std::move(__last), std::move(__result)).second;
+ return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__algorithm/copy_if.h b/libcxx/include/__algorithm/copy_if.h
index d68d1dbbadf8a..228e4d22323e3 100644
--- a/libcxx/include/__algorithm/copy_if.h
+++ b/libcxx/include/__algorithm/copy_if.h
@@ -17,21 +17,16 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _InputIterator, class _OutputIterator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-_OutputIterator
-copy_if(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _Predicate __pred)
-{
- for (; __first != __last; ++__first)
- {
- if (__pred(*__first))
- {
- *__result = *__first;
- ++__result;
- }
+template <class _InputIterator, class _OutputIterator, class _Predicate>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) {
+ for (; __first != __last; ++__first) {
+ if (__pred(*__first)) {
+ *__result = *__first;
+ ++__result;
}
- return __result;
+ }
+ return __result;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__algorithm/copy_move_common.h b/libcxx/include/__algorithm/copy_move_common.h
index c06892e9e3c79..b350507e32bae 100644
--- a/libcxx/include/__algorithm/copy_move_common.h
+++ b/libcxx/include/__algorithm/copy_move_common.h
@@ -38,22 +38,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _From, class _To>
struct __can_lower_copy_assignment_to_memmove {
static const bool value =
- // If the types are always bitcastable, it's valid to do a bitwise copy between them.
- __is_always_bitcastable<_From, _To>::value &&
- // Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays).
- is_trivially_assignable<_To&, const _From&>::value &&
- // `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case.
- !is_volatile<_From>::value &&
- !is_volatile<_To>::value;
+ // If the types are always bitcastable, it's valid to do a bitwise copy between them.
+ __is_always_bitcastable<_From, _To>::value &&
+ // Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays).
+ is_trivially_assignable<_To&, const _From&>::value &&
+ // `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case.
+ !is_volatile<_From>::value && !is_volatile<_To>::value;
};
template <class _From, class _To>
struct __can_lower_move_assignment_to_memmove {
static const bool value =
- __is_always_bitcastable<_From, _To>::value &&
- is_trivially_assignable<_To&, _From&&>::value &&
- !is_volatile<_From>::value &&
- !is_volatile<_To>::value;
+ __is_always_bitcastable<_From, _To>::value && is_trivially_assignable<_To&, _From&&>::value &&
+ !is_volatile<_From>::value && !is_volatile<_To>::value;
};
// `memmove` algorithms implementation.
@@ -95,8 +92,8 @@ struct __can_rewrap<_InIter,
_Sent,
_OutIter,
// Note that sentinels are always copy-constructible.
- __enable_if_t< is_copy_constructible<_InIter>::value &&
- is_copy_constructible<_OutIter>::value > > : true_type {};
+ __enable_if_t< is_copy_constructible<_InIter>::value && is_copy_constructible<_OutIter>::value > >
+ : true_type {};
template <class _Algorithm,
class _InIter,
@@ -108,7 +105,7 @@ __unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) {
auto __range = std::__unwrap_range(__first, std::move(__last));
auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
return std::make_pair(std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.first)),
- ...
[truncated]
|
I know some parts will need |
CC @llvm/libcxx-vendors |
You can test this locally with the following command:git-clang-format --diff 4f54d71501815877898aaa6d764b8468d0708ed6 fd4d116446c948e1e822e12440cccd14c889f1ca -- libcxx/include/__algorithm/binary_search.h libcxx/include/__algorithm/comp_ref_type.h libcxx/include/__algorithm/copy_backward.h libcxx/include/__algorithm/copy_if.h libcxx/include/__algorithm/copy_move_common.h libcxx/include/__algorithm/copy_n.h libcxx/include/__algorithm/equal.h libcxx/include/__algorithm/equal_range.h libcxx/include/__algorithm/fill.h libcxx/include/__algorithm/fill_n.h libcxx/include/__algorithm/find_end.h libcxx/include/__algorithm/find_first_of.h libcxx/include/__algorithm/for_each_n.h libcxx/include/__algorithm/generate.h libcxx/include/__algorithm/generate_n.h libcxx/include/__algorithm/half_positive.h libcxx/include/__algorithm/in_found_result.h libcxx/include/__algorithm/in_fun_result.h libcxx/include/__algorithm/in_in_out_result.h libcxx/include/__algorithm/in_in_result.h libcxx/include/__algorithm/in_out_out_result.h libcxx/include/__algorithm/in_out_result.h libcxx/include/__algorithm/includes.h libcxx/include/__algorithm/inplace_merge.h libcxx/include/__algorithm/is_heap.h libcxx/include/__algorithm/is_heap_until.h libcxx/include/__algorithm/is_partitioned.h libcxx/include/__algorithm/is_permutation.h libcxx/include/__algorithm/is_sorted.h libcxx/include/__algorithm/is_sorted_until.h libcxx/include/__algorithm/iter_swap.h libcxx/include/__algorithm/iterator_operations.h libcxx/include/__algorithm/lexicographical_compare.h libcxx/include/__algorithm/lower_bound.h libcxx/include/__algorithm/make_heap.h libcxx/include/__algorithm/make_projected.h libcxx/include/__algorithm/max.h libcxx/include/__algorithm/max_element.h libcxx/include/__algorithm/merge.h libcxx/include/__algorithm/min.h libcxx/include/__algorithm/min_element.h libcxx/include/__algorithm/min_max_result.h libcxx/include/__algorithm/minmax.h libcxx/include/__algorithm/minmax_element.h libcxx/include/__algorithm/mismatch.h libcxx/include/__algorithm/move.h libcxx/include/__algorithm/move_backward.h libcxx/include/__algorithm/next_permutation.h libcxx/include/__algorithm/nth_element.h libcxx/include/__algorithm/partial_sort.h libcxx/include/__algorithm/partial_sort_copy.h libcxx/include/__algorithm/partition.h libcxx/include/__algorithm/partition_copy.h libcxx/include/__algorithm/partition_point.h libcxx/include/__algorithm/pop_heap.h libcxx/include/__algorithm/prev_permutation.h libcxx/include/__algorithm/push_heap.h libcxx/include/__algorithm/remove.h libcxx/include/__algorithm/remove_copy.h libcxx/include/__algorithm/remove_copy_if.h libcxx/include/__algorithm/remove_if.h libcxx/include/__algorithm/replace.h libcxx/include/__algorithm/replace_copy.h libcxx/include/__algorithm/replace_copy_if.h libcxx/include/__algorithm/replace_if.h libcxx/include/__algorithm/reverse.h libcxx/include/__algorithm/reverse_copy.h libcxx/include/__algorithm/rotate.h libcxx/include/__algorithm/rotate_copy.h libcxx/include/__algorithm/sample.h libcxx/include/__algorithm/search.h libcxx/include/__algorithm/search_n.h libcxx/include/__algorithm/set_difference.h libcxx/include/__algorithm/shift_left.h libcxx/include/__algorithm/shift_right.h libcxx/include/__algorithm/shuffle.h libcxx/include/__algorithm/sift_down.h libcxx/include/__algorithm/sort.h libcxx/include/__algorithm/sort_heap.h libcxx/include/__algorithm/stable_partition.h libcxx/include/__algorithm/stable_sort.h libcxx/include/__algorithm/swap_ranges.h libcxx/include/__algorithm/transform.h libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h libcxx/include/__algorithm/unwrap_iter.h libcxx/include/__atomic/atomic.h libcxx/include/__atomic/atomic_base.h libcxx/include/__atomic/atomic_flag.h libcxx/include/__atomic/atomic_lock_free.h libcxx/include/__atomic/atomic_sync.h libcxx/include/__atomic/check_memory_order.h libcxx/include/__atomic/contention_t.h libcxx/include/__atomic/cxx_atomic_impl.h libcxx/include/__atomic/fence.h libcxx/include/__atomic/kill_dependency.h libcxx/include/__atomic/memory_order.h libcxx/include/__availability libcxx/include/__bit/bit_cast.h libcxx/include/__bit/bit_ceil.h libcxx/include/__bit/byteswap.h libcxx/include/__bit/countl.h libcxx/include/__bit/countr.h libcxx/include/__bit/endian.h libcxx/include/__bit/popcount.h libcxx/include/__chrono/calendar.h libcxx/include/__chrono/convert_to_timespec.h libcxx/include/__chrono/day.h libcxx/include/__chrono/duration.h libcxx/include/__chrono/file_clock.h libcxx/include/__chrono/formatter.h libcxx/include/__chrono/hh_mm_ss.h libcxx/include/__chrono/high_resolution_clock.h libcxx/include/__chrono/literals.h libcxx/include/__chrono/month.h libcxx/include/__chrono/month_weekday.h libcxx/include/__chrono/monthday.h libcxx/include/__chrono/steady_clock.h libcxx/include/__chrono/system_clock.h libcxx/include/__chrono/time_point.h libcxx/include/__chrono/weekday.h libcxx/include/__chrono/year.h libcxx/include/__chrono/year_month.h libcxx/include/__chrono/year_month_day.h libcxx/include/__chrono/year_month_weekday.h libcxx/include/__compare/common_comparison_category.h libcxx/include/__compare/compare_partial_order_fallback.h libcxx/include/__compare/compare_strong_order_fallback.h libcxx/include/__compare/compare_three_way.h libcxx/include/__compare/compare_three_way_result.h libcxx/include/__compare/compare_weak_order_fallback.h libcxx/include/__compare/ordering.h libcxx/include/__compare/partial_order.h libcxx/include/__compare/strong_order.h libcxx/include/__compare/three_way_comparable.h libcxx/include/__compare/weak_order.h libcxx/include/__config libcxx/include/__coroutine/coroutine_handle.h libcxx/include/__coroutine/coroutine_traits.h libcxx/include/__coroutine/noop_coroutine_handle.h libcxx/include/__coroutine/trivial_awaitables.h libcxx/include/__debug_utils/randomize_range.h libcxx/include/__expected/expected.h libcxx/include/__filesystem/copy_options.h libcxx/include/__filesystem/directory_entry.h libcxx/include/__filesystem/directory_iterator.h libcxx/include/__filesystem/directory_options.h libcxx/include/__filesystem/file_status.h libcxx/include/__filesystem/file_type.h libcxx/include/__filesystem/operations.h libcxx/include/__filesystem/path.h libcxx/include/__filesystem/path_iterator.h libcxx/include/__filesystem/perm_options.h libcxx/include/__filesystem/perms.h libcxx/include/__filesystem/recursive_directory_iterator.h libcxx/include/__filesystem/u8path.h libcxx/include/__format/buffer.h libcxx/include/__format/concepts.h libcxx/include/__format/format_arg.h libcxx/include/__format/format_arg_store.h libcxx/include/__format/format_args.h libcxx/include/__format/format_context.h libcxx/include/__format/format_error.h libcxx/include/__format/format_functions.h libcxx/include/__format/format_parse_context.h libcxx/include/__format/format_string.h libcxx/include/__format/formatter.h libcxx/include/__format/formatter_floating_point.h libcxx/include/__format/formatter_integer.h libcxx/include/__format/formatter_integral.h libcxx/include/__format/formatter_output.h libcxx/include/__format/formatter_pointer.h libcxx/include/__format/formatter_string.h libcxx/include/__format/parser_std_format_spec.h libcxx/include/__format/unicode.h libcxx/include/__format/write_escaped.h libcxx/include/__functional/binary_function.h libcxx/include/__functional/binary_negate.h libcxx/include/__functional/bind.h libcxx/include/__functional/bind_back.h libcxx/include/__functional/bind_front.h libcxx/include/__functional/binder1st.h libcxx/include/__functional/binder2nd.h libcxx/include/__functional/boyer_moore_searcher.h libcxx/include/__functional/compose.h libcxx/include/__functional/default_searcher.h libcxx/include/__functional/function.h libcxx/include/__functional/hash.h libcxx/include/__functional/identity.h libcxx/include/__functional/invoke.h libcxx/include/__functional/is_transparent.h libcxx/include/__functional/mem_fn.h libcxx/include/__functional/mem_fun_ref.h libcxx/include/__functional/not_fn.h libcxx/include/__functional/operations.h libcxx/include/__functional/perfect_forward.h libcxx/include/__functional/pointer_to_binary_function.h libcxx/include/__functional/pointer_to_unary_function.h libcxx/include/__functional/ranges_operations.h libcxx/include/__functional/reference_wrapper.h libcxx/include/__functional/unary_function.h libcxx/include/__functional/unary_negate.h libcxx/include/__functional/weak_result_type.h libcxx/include/__fwd/get.h libcxx/include/__fwd/span.h libcxx/include/__fwd/string_view.h libcxx/include/__fwd/subrange.h libcxx/include/__hash_table libcxx/include/__ios/fpos.h libcxx/include/__iterator/access.h libcxx/include/__iterator/advance.h libcxx/include/__iterator/back_insert_iterator.h libcxx/include/__iterator/common_iterator.h libcxx/include/__iterator/concepts.h libcxx/include/__iterator/counted_iterator.h libcxx/include/__iterator/data.h libcxx/include/__iterator/default_sentinel.h libcxx/include/__iterator/distance.h libcxx/include/__iterator/empty.h libcxx/include/__iterator/erase_if_container.h libcxx/include/__iterator/front_insert_iterator.h libcxx/include/__iterator/incrementable_traits.h libcxx/include/__iterator/indirectly_comparable.h libcxx/include/__iterator/insert_iterator.h libcxx/include/__iterator/istream_iterator.h libcxx/include/__iterator/istreambuf_iterator.h libcxx/include/__iterator/iter_move.h libcxx/include/__iterator/iter_swap.h libcxx/include/__iterator/iterator.h libcxx/include/__iterator/iterator_traits.h libcxx/include/__iterator/mergeable.h libcxx/include/__iterator/move_iterator.h libcxx/include/__iterator/move_sentinel.h libcxx/include/__iterator/next.h libcxx/include/__iterator/ostream_iterator.h libcxx/include/__iterator/ostreambuf_iterator.h libcxx/include/__iterator/permutable.h libcxx/include/__iterator/prev.h libcxx/include/__iterator/readable_traits.h libcxx/include/__iterator/reverse_access.h libcxx/include/__iterator/reverse_iterator.h libcxx/include/__iterator/size.h libcxx/include/__iterator/sortable.h libcxx/include/__iterator/unreachable_sentinel.h libcxx/include/__iterator/wrap_iter.h libcxx/include/__locale libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h libcxx/include/__locale_dir/locale_base_api/locale_guard.h libcxx/include/__mbstate_t.h libcxx/include/__memory/addressof.h libcxx/include/__memory/aligned_alloc.h libcxx/include/__memory/allocate_at_least.h libcxx/include/__memory/allocation_guard.h libcxx/include/__memory/allocator.h libcxx/include/__memory/allocator_arg_t.h libcxx/include/__memory/allocator_destructor.h libcxx/include/__memory/allocator_traits.h libcxx/include/__memory/assume_aligned.h libcxx/include/__memory/auto_ptr.h libcxx/include/__memory/builtin_new_allocator.h libcxx/include/__memory/compressed_pair.h libcxx/include/__memory/concepts.h libcxx/include/__memory/construct_at.h libcxx/include/__memory/destruct_n.h libcxx/include/__memory/pointer_traits.h libcxx/include/__memory/ranges_construct_at.h libcxx/include/__memory/ranges_uninitialized_algorithms.h libcxx/include/__memory/raw_storage_iterator.h libcxx/include/__memory/shared_ptr.h libcxx/include/__memory/temp_value.h libcxx/include/__memory/temporary_buffer.h libcxx/include/__memory/uninitialized_algorithms.h libcxx/include/__memory/unique_ptr.h libcxx/include/__memory/uses_allocator.h libcxx/include/__node_handle libcxx/include/__numeric/accumulate.h libcxx/include/__numeric/adjacent_difference.h libcxx/include/__numeric/exclusive_scan.h libcxx/include/__numeric/gcd_lcm.h libcxx/include/__numeric/inclusive_scan.h libcxx/include/__numeric/inner_product.h libcxx/include/__numeric/iota.h libcxx/include/__numeric/midpoint.h libcxx/include/__numeric/partial_sum.h libcxx/include/__numeric/reduce.h libcxx/include/__numeric/transform_exclusive_scan.h libcxx/include/__numeric/transform_inclusive_scan.h libcxx/include/__numeric/transform_reduce.h libcxx/include/__random/bernoulli_distribution.h libcxx/include/__random/binomial_distribution.h libcxx/include/__random/cauchy_distribution.h libcxx/include/__random/chi_squared_distribution.h libcxx/include/__random/clamp_to_integral.h libcxx/include/__random/discard_block_engine.h libcxx/include/__random/discrete_distribution.h libcxx/include/__random/exponential_distribution.h libcxx/include/__random/extreme_value_distribution.h libcxx/include/__random/fisher_f_distribution.h libcxx/include/__random/gamma_distribution.h libcxx/include/__random/generate_canonical.h libcxx/include/__random/geometric_distribution.h libcxx/include/__random/independent_bits_engine.h libcxx/include/__random/is_seed_sequence.h libcxx/include/__random/is_valid.h libcxx/include/__random/linear_congruential_engine.h libcxx/include/__random/log2.h libcxx/include/__random/lognormal_distribution.h libcxx/include/__random/mersenne_twister_engine.h libcxx/include/__random/negative_binomial_distribution.h libcxx/include/__random/normal_distribution.h libcxx/include/__random/piecewise_constant_distribution.h libcxx/include/__random/piecewise_linear_distribution.h libcxx/include/__random/poisson_distribution.h libcxx/include/__random/random_device.h libcxx/include/__random/ranlux.h libcxx/include/__random/seed_seq.h libcxx/include/__random/shuffle_order_engine.h libcxx/include/__random/student_t_distribution.h libcxx/include/__random/subtract_with_carry_engine.h libcxx/include/__random/uniform_int_distribution.h libcxx/include/__random/uniform_random_bit_generator.h libcxx/include/__random/uniform_real_distribution.h libcxx/include/__random/weibull_distribution.h libcxx/include/__ranges/access.h libcxx/include/__ranges/all.h libcxx/include/__ranges/common_view.h libcxx/include/__ranges/concepts.h libcxx/include/__ranges/counted.h libcxx/include/__ranges/data.h libcxx/include/__ranges/drop_view.h libcxx/include/__ranges/empty.h libcxx/include/__ranges/empty_view.h libcxx/include/__ranges/enable_view.h libcxx/include/__ranges/filter_view.h libcxx/include/__ranges/iota_view.h libcxx/include/__ranges/istream_view.h libcxx/include/__ranges/join_view.h libcxx/include/__ranges/lazy_split_view.h libcxx/include/__ranges/non_propagating_cache.h libcxx/include/__ranges/owning_view.h libcxx/include/__ranges/range_adaptor.h libcxx/include/__ranges/rbegin.h libcxx/include/__ranges/ref_view.h libcxx/include/__ranges/rend.h libcxx/include/__ranges/reverse_view.h libcxx/include/__ranges/single_view.h libcxx/include/__ranges/size.h libcxx/include/__ranges/subrange.h libcxx/include/__ranges/take_view.h libcxx/include/__ranges/transform_view.h libcxx/include/__ranges/view_interface.h libcxx/include/__ranges/views.h libcxx/include/__ranges/zip_view.h libcxx/include/__split_buffer libcxx/include/__string/char_traits.h libcxx/include/__support/android/locale_bionic.h libcxx/include/__support/fuchsia/xlocale.h libcxx/include/__support/ibm/gettod_zos.h libcxx/include/__support/ibm/locale_mgmt_zos.h libcxx/include/__support/ibm/nanosleep.h libcxx/include/__support/ibm/xlocale.h libcxx/include/__support/newlib/xlocale.h libcxx/include/__support/win32/locale_win32.h libcxx/include/__support/xlocale/__nop_locale_mgmt.h libcxx/include/__system_error/errc.h libcxx/include/__thread/formatter.h libcxx/include/__thread/poll_with_backoff.h libcxx/include/__thread/this_thread.h libcxx/include/__thread/thread.h libcxx/include/__thread/timed_backoff_policy.h libcxx/include/__threading_support libcxx/include/__tree libcxx/include/__tuple/make_tuple_types.h libcxx/include/__tuple/sfinae_helpers.h libcxx/include/__tuple/tuple_element.h libcxx/include/__tuple/tuple_indices.h libcxx/include/__tuple/tuple_like_ext.h libcxx/include/__tuple/tuple_size.h libcxx/include/__tuple/tuple_types.h libcxx/include/__utility/as_const.h libcxx/include/__utility/cmp.h libcxx/include/__utility/convert_to_integral.h libcxx/include/__utility/exchange.h libcxx/include/__utility/in_place.h libcxx/include/__utility/integer_sequence.h libcxx/include/__utility/pair.h libcxx/include/__utility/piecewise_construct.h libcxx/include/__utility/priority_tag.h libcxx/include/__utility/rel_ops.h libcxx/include/__utility/to_underlying.h libcxx/include/__utility/unreachable.h libcxx/include/__variant/monostate.h libcxx/include/__verbose_abort libcxx/include/any libcxx/include/array libcxx/include/barrier libcxx/include/bitset libcxx/include/cctype libcxx/include/cmath libcxx/include/codecvt libcxx/include/complex libcxx/include/condition_variable libcxx/include/cstddef libcxx/include/ctype.h libcxx/include/cuchar libcxx/include/deque libcxx/include/errno.h libcxx/include/expected libcxx/include/experimental/__config libcxx/include/experimental/__memory libcxx/include/experimental/iterator libcxx/include/experimental/propagate_const libcxx/include/experimental/type_traits libcxx/include/experimental/utility libcxx/include/ext/__hash libcxx/include/ext/hash_map libcxx/include/ext/hash_set libcxx/include/fenv.h libcxx/include/float.h libcxx/include/forward_list libcxx/include/fstream libcxx/include/future libcxx/include/initializer_list libcxx/include/inttypes.h libcxx/include/iomanip libcxx/include/ios libcxx/include/iosfwd libcxx/include/istream libcxx/include/latch libcxx/include/limits libcxx/include/list libcxx/include/locale libcxx/include/locale.h libcxx/include/map libcxx/include/math.h libcxx/include/mutex libcxx/include/new libcxx/include/numbers libcxx/include/optional libcxx/include/ostream libcxx/include/queue libcxx/include/ranges libcxx/include/ratio libcxx/include/regex libcxx/include/scoped_allocator libcxx/include/semaphore libcxx/include/set libcxx/include/span libcxx/include/sstream libcxx/include/stack libcxx/include/stdatomic.h libcxx/include/stdbool.h libcxx/include/stddef.h libcxx/include/stdexcept libcxx/include/stdint.h libcxx/include/stdio.h libcxx/include/stdlib.h libcxx/include/streambuf libcxx/include/string libcxx/include/string.h libcxx/include/string_view libcxx/include/strstream libcxx/include/thread libcxx/include/tuple libcxx/include/typeindex libcxx/include/typeinfo libcxx/include/uchar.h libcxx/include/unordered_map libcxx/include/unordered_set libcxx/include/valarray libcxx/include/variant libcxx/include/vector libcxx/include/wchar.h libcxx/include/wctype.h libcxx/src/any.cpp libcxx/src/atomic.cpp libcxx/src/barrier.cpp libcxx/src/bind.cpp libcxx/src/call_once.cpp libcxx/src/charconv.cpp libcxx/src/chrono.cpp libcxx/src/condition_variable.cpp libcxx/src/condition_variable_destructor.cpp libcxx/src/exception.cpp libcxx/src/filesystem/directory_entry.cpp libcxx/src/filesystem/directory_iterator.cpp libcxx/src/filesystem/error.h libcxx/src/filesystem/file_descriptor.h libcxx/src/filesystem/filesystem_clock.cpp libcxx/src/filesystem/filesystem_error.cpp libcxx/src/filesystem/int128_builtins.cpp libcxx/src/filesystem/operations.cpp libcxx/src/filesystem/path.cpp libcxx/src/filesystem/path_parser.h libcxx/src/filesystem/posix_compat.h libcxx/src/filesystem/time_utils.h libcxx/src/functional.cpp libcxx/src/future.cpp libcxx/src/hash.cpp libcxx/src/include/apple_availability.h libcxx/src/include/atomic_support.h libcxx/src/include/config_elast.h libcxx/src/include/refstring.h libcxx/src/include/ryu/ryu.h libcxx/src/include/sso_allocator.h libcxx/src/ios.cpp libcxx/src/iostream.cpp libcxx/src/locale.cpp libcxx/src/memory.cpp libcxx/src/mutex.cpp libcxx/src/mutex_destructor.cpp libcxx/src/optional.cpp libcxx/src/random.cpp libcxx/src/random_shuffle.cpp libcxx/src/regex.cpp libcxx/src/std_stream.h libcxx/src/string.cpp libcxx/src/support/ibm/mbsnrtowcs.cpp libcxx/src/support/ibm/wcsnrtombs.cpp libcxx/src/support/ibm/xlocale_zos.cpp libcxx/src/support/win32/locale_win32.cpp libcxx/src/support/win32/support.cpp libcxx/src/support/win32/thread_win32.cpp libcxx/src/system_error.cpp libcxx/src/thread.cpp libcxx/src/typeinfo.cpp libcxx/src/valarray.cpp libcxx/src/variant.cpp libcxx/src/vector.cpp libcxx/src/verbose_abort.cpp View the diff from clang-format here.diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 73b24dbf59..6165dc84ba 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -975,7 +975,7 @@ const ctype<char>::mask* ctype<char>::classic_table() noexcept {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
// clang-format on
- return builtin_table;
+ return builtin_table;
}
#else
const ctype<char>::mask* ctype<char>::classic_table() noexcept {
diff --git a/libcxx/src/support/ibm/mbsnrtowcs.cpp b/libcxx/src/support/ibm/mbsnrtowcs.cpp
index 122dc5ed89..2bda0d1770 100644
--- a/libcxx/src/support/ibm/mbsnrtowcs.cpp
+++ b/libcxx/src/support/ibm/mbsnrtowcs.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#include <cstddef> // size_t
-#include <cwchar> // mbstate_t
+#include <cstddef> // size_t
+#include <cwchar> // mbstate_t
#include <limits.h> // MB_LEN_MAX
#include <string.h> // wmemcpy
|
50a169c
to
38121d9
Compare
I went through everything and this is the set of annotations I'd add for now: #74352. Other suggestions are welcome. |
585820e
to
6ac7a38
Compare
I think template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) & noexcept(
noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
-> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
} If we just run this through // option #1
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const& noexcept(
noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
-> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
} This is not aligned anymore, and it's harder to read. This example isn't very ugly, but we have a few others that do become harder to read when they're not aligned anymore. If we're not happy with this, another option would be to use "clever" comments: // option #2
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) & noexcept(
noexcept(/* */ _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
-> decltype(/**/ _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) //
{
return /* */ _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
} The third option would be to use a macro. We previously discussed this but eventually ended up not doing it: // option 3
# define _LIBCPP_EXPRESSION_EQUIVALENT(expr) \
noexcept(noexcept(expr))->decltype(expr) { return expr; } \
static_assert(true, "")
template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const& //
_LIBCPP_EXPRESSION_EQUIVALENT(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)); |
@ldionne Would this new clang-format 18 option help: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowbreakbeforenoexceptspecifier |
Thanks for pointing this out, I wasn't aware of it! However, I am not sure it would fix our issues because it probably still wouldn't align the three identical bits of code. It feels like |
This patch runs clang-format on all of libcxx/include and libcxx/src, in accordance with the RFC discussed at [1]. Follow-up patches will format the benchmarks, the test suite and remaining parts of the code. I'm splitting this one into its own patch so the diff is a bit easier to review. This patch was generated with: find libcxx/include libcxx/src -type f \ | grep -v 'module.modulemap.in' \ | grep -v 'CMakeLists.txt' \ | grep -v 'README.txt' \ | grep -v 'libcxx.imp' \ | grep -v '__config_site.in' \ | xargs clang-format -i A Git merge driver is available in libcxx/utils/clang-format-merge-driver.sh to help resolve merge and rebase issues across these formatting changes. [1]: https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all
6ac7a38
to
fd4d116
Compare
Looks like this broke the build of libc++ on Windows with the following error:
|
It looks like the formatting changed the order of includes in - #include <windows.h>
- #include <process.h>
#include <fibersapi.h>
+ #include <process.h>
+ #include <windows.h> I didn't have a chance to verify this locally yet, but I suspect this is the culprit. |
@petrhosek I just looked and thought the same. If this is actually the problem, IMO it's kinda insane that the windows headers don't properly IWYU. Would be great if you could check it out and make a patch to fix it if that's actually the problem. I'd rather avoid reverting any re-applying this patch. |
As reported in [1], it looks like the Windows headers are picky about the order in which they are included, and the clang-format change broke the build by reordering the headers. [1]: #74334 (comment)
@petrhosek Thanks, I just did de5c49f to try and make the build green again. Let me know if you still see issues. |
On Windows, |
Thanks @ldionne, that resolved the issue. I looked into solutions, and the only two options I found are to either disable Clang-Format:
or to move
|
As reported in [1], it looks like the Windows headers are picky about the order in which they are included, and the clang-format change broke the build by reordering the headers. [1]: llvm/llvm-project#74334 (comment) NOKEYCHECK=True GitOrigin-RevId: de5c49f7e63f3237afe1e647d359cb8a5227ba4d
As reported in [1], it looks like the Windows headers are picky about the order in which they are included, and the clang-format change broke the build by reordering the headers. [1]: llvm/llvm-project#74334 (comment)
This patch runs clang-format on all of libcxx/include and libcxx/src, in accordance with the RFC discussed at 1. Follow-up patches will format the benchmarks, the test suite and remaining parts of the code. I'm splitting this one into its own patch so the diff is a bit easier to review.
This patch was generated with:
A Git merge driver is available in libcxx/utils/clang-format-merge-driver.sh
to help resolve merge and rebase issues across these formatting changes.