Skip to content

Commit 78fc8ca

Browse files
clang-format
1 parent 4133867 commit 78fc8ca

File tree

7 files changed

+61
-63
lines changed

7 files changed

+61
-63
lines changed

libcxx/include/__tree

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ public:
551551
__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__p);
552552
}
553553

554-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node_base() = default;
555-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__tree_node_base() = default;
554+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node_base() = default;
555+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__tree_node_base() = default;
556556
__tree_node_base(__tree_node_base const&) = delete;
557557
__tree_node_base& operator=(__tree_node_base const&) = delete;
558558
};
@@ -703,7 +703,8 @@ public:
703703

704704
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
705705

706-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
706+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT
707+
: __ptr_(__p.__ptr_) {}
707708

708709
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return __get_np()->__value_; }
709710
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const {
@@ -834,8 +835,11 @@ public:
834835
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_allocator& __node_alloc() _NOEXCEPT {
835836
return __node_alloc_;
836837
}
838+
837839
private:
838-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const __node_allocator& __node_alloc() const _NOEXCEPT { return __node_alloc_; }
840+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const __node_allocator& __node_alloc() const _NOEXCEPT {
841+
return __node_alloc_;
842+
}
839843

840844
public:
841845
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type __alloc() const _NOEXCEPT {
@@ -1003,31 +1007,31 @@ public:
10031007
template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
10041008
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
10051009
__insert_unique_from_orphaned_node(const_iterator __p, __get_node_value_type_t<_Tp>&& __value) {
1006-
1007-
#if _LIBCPP_STD_VER >= 26
1008-
if constexpr (
1009-
integral_constant<bool, is_copy_constructible<decltype(__value.first)>::value >()
1010-
) {
1010+
#if _LIBCPP_STD_VER >= 26
1011+
if constexpr (integral_constant<bool, is_copy_constructible<decltype(__value.first)>::value >()) {
10111012
__emplace_hint_unique(__p, std::move(__value.first), std::move(__value.second));
1012-
} else
1013-
#endif
1013+
} else
1014+
#endif
10141015
{
10151016
__emplace_hint_unique(__p, const_cast<key_type&&>(__value.first), std::move(__value.second));
10161017
}
10171018
}
10181019

10191020
template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
1020-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_unique_from_orphaned_node(const_iterator __p, _Tp&& __value) {
1021+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1022+
__insert_unique_from_orphaned_node(const_iterator __p, _Tp&& __value) {
10211023
__emplace_hint_unique(__p, std::move(__value));
10221024
}
10231025

10241026
template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
1025-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_multi_from_orphaned_node(const_iterator __p, value_type&& __value) {
1027+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1028+
__insert_multi_from_orphaned_node(const_iterator __p, value_type&& __value) {
10261029
__emplace_hint_multi(__p, const_cast<key_type&&>(__value.first), std::move(__value.second));
10271030
}
10281031

10291032
template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
1030-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_multi_from_orphaned_node(const_iterator __p, _Tp&& __value) {
1033+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1034+
__insert_multi_from_orphaned_node(const_iterator __p, _Tp&& __value) {
10311035
__emplace_hint_multi(__p, std::move(__value));
10321036
}
10331037

@@ -1186,20 +1190,18 @@ private:
11861190
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
11871191

11881192
template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
1189-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
1193+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1194+
__assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
11901195
using __key_type = __remove_const_t<typename value_type::first_type>;
11911196

1192-
1193-
#if _LIBCPP_STD_VER >= 26
1197+
#if _LIBCPP_STD_VER >= 26
11941198

1195-
if constexpr (
1196-
integral_constant<bool, is_copy_constructible<decltype(__rhs.first)>::value >()
1197-
){
1198-
// we use copy, and not "move" as the constraint
1199-
// because we can NOT move from `const key_type`, which is how `value_type` is defined
1200-
// atleast for map
1201-
// typedef pair<const key_type, mapped_type> value_type;
1202-
// so we must copy it
1199+
if constexpr (integral_constant<bool, is_copy_constructible<decltype(__rhs.first)>::value >()) {
1200+
// we use copy, and not "move" as the constraint
1201+
// because we can NOT move from `const key_type`, which is how `value_type` is defined
1202+
// atleast for map
1203+
// typedef pair<const key_type, mapped_type> value_type;
1204+
// so we must copy it
12031205

12041206
// const_cast is not allowed at constexpr time.
12051207
// we get around this by deleting __lhs and creating a new node in-place
@@ -1211,13 +1213,10 @@ private:
12111213
using __node_value_type = __get_node_value_type_t<value_type>;
12121214
__node_value_type __tmp(__rhs.first, __rhs.second);
12131215

1214-
12151216
__node_traits::construct(__na, std::addressof(__lhs), std::move(__tmp));
12161217

1217-
1218-
1219-
} else
1220-
#endif
1218+
} else
1219+
#endif
12211220
{
12221221
// This is technically UB, since the object was constructed as `const`.
12231222
// Clang doesn't optimize on this currently though.
@@ -1344,7 +1343,8 @@ private:
13441343
// If we already have a left node in the destination tree, reuse it and copy-assign recursively
13451344
if (__dest->__left_) {
13461345
__dest->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_assign_tree(
1347-
std::__static_fancy_pointer_cast<__node_pointer>(__dest->__left_), std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_)));
1346+
std::__static_fancy_pointer_cast<__node_pointer>(__dest->__left_),
1347+
std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_)));
13481348

13491349
// Otherwise, we must create new nodes; copy-construct from here on
13501350
} else if (__src->__left_) {
@@ -1356,7 +1356,8 @@ private:
13561356
// Identical to the left case above, just for the right nodes
13571357
if (__dest->__right_) {
13581358
__dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_assign_tree(
1359-
std::__static_fancy_pointer_cast<__node_pointer>(__dest->__right_), std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_)));
1359+
std::__static_fancy_pointer_cast<__node_pointer>(__dest->__right_),
1360+
std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_)));
13601361
} else if (__src->__right_) {
13611362
auto __new_right = __copy_construct_tree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_));
13621363
__dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__new_right);
@@ -1429,7 +1430,8 @@ __tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_poin
14291430
}
14301431

14311432
template <class _Tp, class _Compare, class _Allocator>
1432-
_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) {
1433+
_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>&
1434+
__tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) {
14331435
if (this == std::addressof(__t))
14341436
return *this;
14351437

@@ -1443,8 +1445,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Co
14431445
if (__root())
14441446
__root()->__parent_ = __end_node();
14451447
}
1446-
__begin_node_ =
1447-
__end_node()->__left_ ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) : __end_node();
1448+
__begin_node_ = __end_node()->__left_
1449+
? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_))
1450+
: __end_node();
14481451
__size_ = __t.size();
14491452

14501453
return *this;
@@ -1884,14 +1887,14 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
18841887
__node_allocator& __na = __node_alloc();
18851888
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
18861889

1887-
#if _LIBCPP_STD_VER >= 26
1888-
if(__libcpp_is_constant_evaluated()) {
1889-
// note: construction of subobject of object outside its lifetime is not allowed in a constant expression
1890-
std::__construct_at(std::addressof(*__h), std::forward<_Args>(__args)...);
1891-
} else
1892-
#endif
1890+
#if _LIBCPP_STD_VER >= 26
1891+
if (__libcpp_is_constant_evaluated()) {
1892+
// note: construction of subobject of object outside its lifetime is not allowed in a constant expression
1893+
std::__construct_at(std::addressof(*__h), std::forward<_Args>(__args)...);
1894+
} else
1895+
#endif
18931896
{
1894-
__node_traits::construct(__na, std::addressof(__h->__value_), std::forward<_Args>(__args)...);
1897+
__node_traits::construct(__na, std::addressof(__h->__value_), std::forward<_Args>(__args)...);
18951898
}
18961899

18971900
__h.get_deleter().__value_constructed = true;

libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
7474
assert(m[6] == 6.5);
7575
assert(m.size() == 8);
7676
}
77-
#ifndef TEST_IS_CONSTANT_EVALUATED
77+
# ifndef TEST_IS_CONSTANT_EVALUATED
7878
{
7979
// Use "container_test_types.h" to check what arguments get passed
8080
// to the allocator for operator[]
@@ -108,7 +108,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
108108
}
109109
}
110110
}
111-
#endif
111+
# endif
112112
#endif
113113
#if TEST_STD_VER > 11
114114
{

libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ TEST_CONSTEXPR_CXX26 bool test() {
5353
assert(m[6] == 6.5);
5454
assert(m.size() == 2);
5555
}
56-
// #ifndef FAKE_MACRO_NOOOOOO
57-
#ifndef TEST_IS_CONSTANT_EVALUATED
58-
{
56+
// #ifndef FAKE_MACRO_NOOOOOO
57+
#ifndef TEST_IS_CONSTANT_EVALUATED
58+
{
5959
// Use "container_test_types.h" to check what arguments get passed
6060
// to the allocator for operator[]
6161
using Container = TCT::map<>;
@@ -77,8 +77,8 @@ TEST_CONSTEXPR_CXX26 bool test() {
7777
}
7878
}
7979
}
80-
81-
#endif
80+
81+
#endif
8282
return true;
8383
}
8484

@@ -89,7 +89,7 @@ int main(int, char**) {
8989
#endif
9090

9191
// can't run this as a constant expression
92-
// because
92+
// because
9393
// existing implementation relies on UB to avoid allocatr::construct_at()
9494
// instantiating anything other than container::value_type
9595
// assert(test_container_general_requirements());

libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ TEST_CONSTEXPR_CXX26 bool test() {
140140
return true;
141141
}
142142

143-
144143
int main(int, char**) {
145144
assert(test());
146145
#if TEST_STD_VER >= 26

libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,18 @@ TEST_CONSTEXPR_CXX26 bool test_alloc(const Alloc& new_alloc) {
8585
}
8686

8787
TEST_CONSTEXPR_CXX26 bool test() {
88-
89-
9088
#if TEST_STD_VER >= 26
9189

9290
static_assert(test_alloc(std::allocator<std::pair<const int, int> >()));
93-
static_assert(test_alloc(test_allocator<std::pair<const int, int> >(25))); // Make sure that the new allocator is actually used
94-
static_assert(test_alloc(min_allocator<std::pair<const int, int> >())); // Make sure that fancy pointers work
91+
static_assert(
92+
test_alloc(test_allocator<std::pair<const int, int> >(25))); // Make sure that the new allocator is actually used
93+
static_assert(test_alloc(min_allocator<std::pair<const int, int> >())); // Make sure that fancy pointers work
9594
#endif
9695

9796
test_alloc(std::allocator<std::pair<const int, int> >());
9897
test_alloc(test_allocator<std::pair<const int, int> >(25)); // Make sure that the new allocator is actually used
9998
test_alloc(min_allocator<std::pair<const int, int> >()); // Make sure that fancy pointers work
10099

101-
102-
103100
{ // Ensure that the comparator is copied
104101
using V = std::pair<const int, int>;
105102
using Map = std::map<int, int, test_less<int> >;
@@ -118,7 +115,6 @@ TEST_CONSTEXPR_CXX26 bool test() {
118115
return true;
119116
}
120117

121-
122118
int main(int, char**) {
123119
assert(test());
124120
#if TEST_STD_VER >= 26

libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ struct NoOp {
6767
};
6868

6969
template <class Alloc, class AllocatorInvariant = NoOp>
70-
TEST_CONSTEXPR_CXX26 bool test_alloc(const Alloc& lhs_alloc = Alloc(),
71-
const Alloc& rhs_alloc = Alloc(),
72-
AllocatorInvariant check_alloc_invariant = NoOp()) {
70+
TEST_CONSTEXPR_CXX26 bool
71+
test_alloc(const Alloc& lhs_alloc = Alloc(),
72+
const Alloc& rhs_alloc = Alloc(),
73+
AllocatorInvariant check_alloc_invariant = NoOp()) {
7374
{ // Test empty/non-empy map combinations
7475
{ // assign from a non-empty container into an empty one
7576
using V = std::pair<const int, int>;
@@ -308,7 +309,6 @@ TEST_CONSTEXPR_CXX26 bool test() {
308309
return true;
309310
}
310311

311-
312312
int main(int, char**) {
313313
assert(test());
314314
#if TEST_STD_VER >= 26

libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "min_allocator.h"
2525

2626
TEST_CONSTEXPR_CXX26
27-
bool test() {
27+
bool test() {
2828
{
2929
typedef std::pair<MoveOnly, MoveOnly> V;
3030
typedef std::pair<const MoveOnly, MoveOnly> VC;

0 commit comments

Comments
 (0)