Skip to content

Commit 9783f28

Browse files
authoredDec 18, 2023
[libc++] Format the code base (#74334)
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
1 parent e5c523e commit 9783f28

File tree

542 files changed

+67543
-84889
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

542 files changed

+67543
-84889
lines changed
 

‎.gitattributes

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
libcxx/src/**/*.cpp merge=libcxx-reformat
2+
libcxx/include/**/*.h merge=libcxx-reformat
3+
4+
# Explicitly handle files with no extension
5+
libcxx/include/__availability merge=libcxx-reformat
6+
libcxx/include/__bit_reference merge=libcxx-reformat
7+
libcxx/include/__config merge=libcxx-reformat
8+
libcxx/include/__hash_table merge=libcxx-reformat
9+
libcxx/include/__locale merge=libcxx-reformat
10+
libcxx/include/__node_handle merge=libcxx-reformat
11+
libcxx/include/__split_buffer merge=libcxx-reformat
12+
libcxx/include/__std_clang_module merge=libcxx-reformat
13+
libcxx/include/__threading_support merge=libcxx-reformat
14+
libcxx/include/__tree merge=libcxx-reformat
15+
libcxx/include/__verbose_abort merge=libcxx-reformat
16+
libcxx/include/algorithm merge=libcxx-reformat
17+
libcxx/include/any merge=libcxx-reformat
18+
libcxx/include/array merge=libcxx-reformat
19+
libcxx/include/atomic merge=libcxx-reformat
20+
libcxx/include/barrier merge=libcxx-reformat
21+
libcxx/include/bit merge=libcxx-reformat
22+
libcxx/include/bitset merge=libcxx-reformat
23+
libcxx/include/cassert merge=libcxx-reformat
24+
libcxx/include/ccomplex merge=libcxx-reformat
25+
libcxx/include/cctype merge=libcxx-reformat
26+
libcxx/include/cerrno merge=libcxx-reformat
27+
libcxx/include/cfenv merge=libcxx-reformat
28+
libcxx/include/cfloat merge=libcxx-reformat
29+
libcxx/include/charconv merge=libcxx-reformat
30+
libcxx/include/chrono merge=libcxx-reformat
31+
libcxx/include/cinttypes merge=libcxx-reformat
32+
libcxx/include/ciso646 merge=libcxx-reformat
33+
libcxx/include/climits merge=libcxx-reformat
34+
libcxx/include/clocale merge=libcxx-reformat
35+
libcxx/include/cmath merge=libcxx-reformat
36+
libcxx/include/codecvt merge=libcxx-reformat
37+
libcxx/include/compare merge=libcxx-reformat
38+
libcxx/include/complex merge=libcxx-reformat
39+
libcxx/include/concepts merge=libcxx-reformat
40+
libcxx/include/condition_variable merge=libcxx-reformat
41+
libcxx/include/coroutine merge=libcxx-reformat
42+
libcxx/include/csetjmp merge=libcxx-reformat
43+
libcxx/include/csignal merge=libcxx-reformat
44+
libcxx/include/cstdarg merge=libcxx-reformat
45+
libcxx/include/cstdbool merge=libcxx-reformat
46+
libcxx/include/cstddef merge=libcxx-reformat
47+
libcxx/include/cstdint merge=libcxx-reformat
48+
libcxx/include/cstdio merge=libcxx-reformat
49+
libcxx/include/cstdlib merge=libcxx-reformat
50+
libcxx/include/cstring merge=libcxx-reformat
51+
libcxx/include/ctgmath merge=libcxx-reformat
52+
libcxx/include/ctime merge=libcxx-reformat
53+
libcxx/include/cuchar merge=libcxx-reformat
54+
libcxx/include/cwchar merge=libcxx-reformat
55+
libcxx/include/cwctype merge=libcxx-reformat
56+
libcxx/include/deque merge=libcxx-reformat
57+
libcxx/include/exception merge=libcxx-reformat
58+
libcxx/include/execution merge=libcxx-reformat
59+
libcxx/include/expected merge=libcxx-reformat
60+
libcxx/include/experimental/__config merge=libcxx-reformat
61+
libcxx/include/experimental/__memory merge=libcxx-reformat
62+
libcxx/include/experimental/deque merge=libcxx-reformat
63+
libcxx/include/experimental/forward_list merge=libcxx-reformat
64+
libcxx/include/experimental/iterator merge=libcxx-reformat
65+
libcxx/include/experimental/list merge=libcxx-reformat
66+
libcxx/include/experimental/map merge=libcxx-reformat
67+
libcxx/include/experimental/memory merge=libcxx-reformat
68+
libcxx/include/experimental/memory_resource merge=libcxx-reformat
69+
libcxx/include/experimental/propagate_const merge=libcxx-reformat
70+
libcxx/include/experimental/regex merge=libcxx-reformat
71+
libcxx/include/experimental/set merge=libcxx-reformat
72+
libcxx/include/experimental/simd merge=libcxx-reformat
73+
libcxx/include/experimental/string merge=libcxx-reformat
74+
libcxx/include/experimental/type_traits merge=libcxx-reformat
75+
libcxx/include/experimental/unordered_map merge=libcxx-reformat
76+
libcxx/include/experimental/unordered_set merge=libcxx-reformat
77+
libcxx/include/experimental/utility merge=libcxx-reformat
78+
libcxx/include/experimental/vector merge=libcxx-reformat
79+
libcxx/include/ext/__hash merge=libcxx-reformat
80+
libcxx/include/ext/hash_map merge=libcxx-reformat
81+
libcxx/include/ext/hash_set merge=libcxx-reformat
82+
libcxx/include/filesystem merge=libcxx-reformat
83+
libcxx/include/format merge=libcxx-reformat
84+
libcxx/include/forward_list merge=libcxx-reformat
85+
libcxx/include/fstream merge=libcxx-reformat
86+
libcxx/include/functional merge=libcxx-reformat
87+
libcxx/include/future merge=libcxx-reformat
88+
libcxx/include/initializer_list merge=libcxx-reformat
89+
libcxx/include/iomanip merge=libcxx-reformat
90+
libcxx/include/ios merge=libcxx-reformat
91+
libcxx/include/iosfwd merge=libcxx-reformat
92+
libcxx/include/iostream merge=libcxx-reformat
93+
libcxx/include/istream merge=libcxx-reformat
94+
libcxx/include/iterator merge=libcxx-reformat
95+
libcxx/include/latch merge=libcxx-reformat
96+
libcxx/include/limits merge=libcxx-reformat
97+
libcxx/include/list merge=libcxx-reformat
98+
libcxx/include/locale merge=libcxx-reformat
99+
libcxx/include/map merge=libcxx-reformat
100+
libcxx/include/mdspan merge=libcxx-reformat
101+
libcxx/include/memory merge=libcxx-reformat
102+
libcxx/include/memory_resource merge=libcxx-reformat
103+
libcxx/include/mutex merge=libcxx-reformat
104+
libcxx/include/new merge=libcxx-reformat
105+
libcxx/include/numbers merge=libcxx-reformat
106+
libcxx/include/numeric merge=libcxx-reformat
107+
libcxx/include/optional merge=libcxx-reformat
108+
libcxx/include/ostream merge=libcxx-reformat
109+
libcxx/include/print merge=libcxx-reformat
110+
libcxx/include/queue merge=libcxx-reformat
111+
libcxx/include/random merge=libcxx-reformat
112+
libcxx/include/ranges merge=libcxx-reformat
113+
libcxx/include/ratio merge=libcxx-reformat
114+
libcxx/include/regex merge=libcxx-reformat
115+
libcxx/include/scoped_allocator merge=libcxx-reformat
116+
libcxx/include/semaphore merge=libcxx-reformat
117+
libcxx/include/set merge=libcxx-reformat
118+
libcxx/include/shared_mutex merge=libcxx-reformat
119+
libcxx/include/source_location merge=libcxx-reformat
120+
libcxx/include/span merge=libcxx-reformat
121+
libcxx/include/sstream merge=libcxx-reformat
122+
libcxx/include/stack merge=libcxx-reformat
123+
libcxx/include/stdexcept merge=libcxx-reformat
124+
libcxx/include/stop_token merge=libcxx-reformat
125+
libcxx/include/streambuf merge=libcxx-reformat
126+
libcxx/include/string merge=libcxx-reformat
127+
libcxx/include/string_view merge=libcxx-reformat
128+
libcxx/include/strstream merge=libcxx-reformat
129+
libcxx/include/syncstream merge=libcxx-reformat
130+
libcxx/include/system_error merge=libcxx-reformat
131+
libcxx/include/thread merge=libcxx-reformat
132+
libcxx/include/tuple merge=libcxx-reformat
133+
libcxx/include/type_traits merge=libcxx-reformat
134+
libcxx/include/typeindex merge=libcxx-reformat
135+
libcxx/include/typeinfo merge=libcxx-reformat
136+
libcxx/include/unordered_map merge=libcxx-reformat
137+
libcxx/include/unordered_set merge=libcxx-reformat
138+
libcxx/include/utility merge=libcxx-reformat
139+
libcxx/include/valarray merge=libcxx-reformat
140+
libcxx/include/variant merge=libcxx-reformat
141+
libcxx/include/vector merge=libcxx-reformat
142+
libcxx/include/version merge=libcxx-reformat

‎libcxx/include/__algorithm/binary_search.h

+7-13
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,16 @@
2222
_LIBCPP_BEGIN_NAMESPACE_STD
2323

2424
template <class _ForwardIterator, class _Tp, class _Compare>
25-
_LIBCPP_NODISCARD_EXT inline
26-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
27-
bool
28-
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
29-
{
30-
__first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
31-
return __first != __last && !__comp(__value, *__first);
25+
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
26+
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
27+
__first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
28+
return __first != __last && !__comp(__value, *__first);
3229
}
3330

3431
template <class _ForwardIterator, class _Tp>
35-
_LIBCPP_NODISCARD_EXT inline
36-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
37-
bool
38-
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
39-
{
40-
return std::binary_search(__first, __last, __value, __less<>());
32+
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
33+
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
34+
return std::binary_search(__first, __last, __value, __less<>());
4135
}
4236

4337
_LIBCPP_END_NAMESPACE_STD

0 commit comments

Comments
 (0)
Please sign in to comment.