Skip to content

Commit e28df17

Browse files
clang-format
1 parent 07034d1 commit e28df17

File tree

3 files changed

+96
-75
lines changed

3 files changed

+96
-75
lines changed

libcxx/include/__tree

Lines changed: 84 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,8 @@ public:
594594
_LIBCPP_HIDE_FROM_ABI __node_value_type& __get_value() { return __value_; }
595595

596596
template <class... _Args>
597-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node(_Args&&... __args) : __value_(std::forward<_Args>(__args)...) {}
597+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node(_Args&&... __args)
598+
: __value_(std::forward<_Args>(__args)...) {}
598599
// TODO: libcxx26
599600
// _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node(__node_value_type && args): __value_{args} { }
600601
~__tree_node() = delete;
@@ -882,17 +883,23 @@ public:
882883
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer __end_node() const _NOEXCEPT {
883884
return pointer_traits<__end_node_pointer>::pointer_to(const_cast<__end_node_t&>(__end_node_));
884885
}
885-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_allocator& __node_alloc() _NOEXCEPT { return __node_alloc_; }
886+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_allocator& __node_alloc() _NOEXCEPT {
887+
return __node_alloc_;
888+
}
886889

887890
private:
888891
_LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __node_alloc_; }
889892

890893
public:
891-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type __alloc() const _NOEXCEPT { return allocator_type(__node_alloc()); }
894+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type __alloc() const _NOEXCEPT {
895+
return allocator_type(__node_alloc());
896+
}
892897

893898
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { return __size_; }
894899
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare& value_comp() _NOEXCEPT { return __value_comp_; }
895-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const value_compare& value_comp() const _NOEXCEPT { return __value_comp_; }
900+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const value_compare& value_comp() const _NOEXCEPT {
901+
return __value_comp_;
902+
}
896903

897904
public:
898905
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __root() const _NOEXCEPT {
@@ -961,9 +968,13 @@ public:
961968
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__tree();
962969

963970
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { return iterator(__begin_node_); }
964-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT { return const_iterator(__begin_node_); }
971+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
972+
return const_iterator(__begin_node_);
973+
}
965974
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { return iterator(__end_node()); }
966-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT { return const_iterator(__end_node()); }
975+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
976+
return const_iterator(__end_node());
977+
}
967978

968979
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
969980
return std::min<size_type>(__node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max());
@@ -1825,75 +1836,79 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
18251836
if (__child == nullptr) {
18261837
__node_holder __h = __construct_node(std::forward<_Args>(__args)...);
18271838

1828-
/*
1829-
error: cannot convert
1830-
'__node_holder'
1831-
(aka
1832-
' unique_ptr<
1833-
__tree_node<
1834-
std::__value_type<int, double>,
1835-
min_pointer<void, std::integral_constant<unsigned long, 0> >
1836-
>,
1837-
__tree_node_destructor<
1838-
min_allocator<
1839-
std::__tree_node<
1839+
/*
1840+
error: cannot convert
1841+
'__node_holder'
1842+
(aka
1843+
' unique_ptr<
1844+
__tree_node<
18401845
std::__value_type<int, double>,
18411846
min_pointer<void, std::integral_constant<unsigned long, 0> >
1847+
>,
1848+
__tree_node_destructor<
1849+
min_allocator<
1850+
std::__tree_node<
1851+
std::__value_type<int, double>,
1852+
min_pointer<void, std::integral_constant<unsigned long, 0> >
1853+
>
1854+
>
18421855
>
18431856
>
1844-
>
1845-
>
1846-
'
1847-
)
1848-
to 'double' without a conversion operator
1849-
*/
1857+
'
1858+
)
1859+
to 'double' without a conversion operator
1860+
*/
18501861
// double d2 =static_cast<double>(__h);
18511862
// (void)d2;
18521863

1853-
/*
1854-
error: cannot convert 'pointer'
1855-
(aka
1856-
' min_pointer<
1857-
std::__tree_node<
1858-
std::__value_type<int, double>,
1859-
min_pointer<void, std::integral_constant<unsigned long, 0>>
1860-
>
1861-
>
1862-
') to 'double' without a conversion operator
1863-
*/
1864+
/*
1865+
error: cannot convert 'pointer'
1866+
(aka
1867+
' min_pointer<
1868+
std::__tree_node<
1869+
std::__value_type<int, double>,
1870+
min_pointer<void, std::integral_constant<unsigned long, 0>>
1871+
>
1872+
>
1873+
') to 'double' without a conversion operator
1874+
*/
18641875
// double d =static_cast<double>(__h.get());
18651876
// (void)d;
18661877

1867-
/*
1868-
error: cannot convert '__node_base_pointer' (aka
1869-
' min_pointer<
1870-
std::__tree_node_base<
1871-
min_pointer<void, std::integral_constant<unsigned long, 0>>
1872-
>,
1873-
std::integral_constant<unsigned long, 0>
1874-
>
1875-
') to 'double' without a conversion operator
1876-
*/
1878+
/*
1879+
error: cannot convert '__node_base_pointer' (aka
1880+
' min_pointer<
1881+
std::__tree_node_base<
1882+
min_pointer<void, std::integral_constant<unsigned long, 0>>
1883+
>,
1884+
std::integral_constant<unsigned long, 0>
1885+
>
1886+
') to 'double' without a conversion operator
1887+
*/
18771888

1878-
// __node_base_pointer xxx = nullptr;
1879-
// (void)xxx;
1889+
// __node_base_pointer xxx = nullptr;
1890+
// (void)xxx;
18801891
// double d3 =static_cast<double>(xxx);
18811892
// (void)d3;
18821893

18831894
// __node_base_pointer __foo = static_cast<__node_base_pointer>(__h.get());
18841895
// (void)__foo;
18851896
// __maybe_unused__ __node_base_pointer __foo2 = __node_base_pointer(__h.get());
18861897

1887-
/*
1888-
error: cannot convert '__tree<std::__value_type<int, double>, std::__map_value_compare<int, std::pair<const int, double>, std::less<int>, true>, min_allocator<std::pair<const int, double>>>::__node_holder' (aka 'unique_ptr<__tree_node<std::__value_type<int, double>, min_pointer<void, std::integral_constant<unsigned long, 0>>>, __tree_node_destructor<min_allocator<std::__tree_node<std::__value_type<int, double>, min_pointer<void, std::integral_constant<unsigned long, 0>>>>>>') to 'double' without a conversion operator
1889-
*/
1898+
/*
1899+
error: cannot convert '__tree<std::__value_type<int, double>, std::__map_value_compare<int, std::pair<const int,
1900+
double>, std::less<int>, true>, min_allocator<std::pair<const int, double>>>::__node_holder' (aka
1901+
'unique_ptr<__tree_node<std::__value_type<int, double>, min_pointer<void, std::integral_constant<unsigned long,
1902+
0>>>, __tree_node_destructor<min_allocator<std::__tree_node<std::__value_type<int, double>, min_pointer<void,
1903+
std::integral_constant<unsigned long, 0>>>>>>') to 'double' without a conversion operator
1904+
*/
18901905
// __tree<_Tp, _Compare, _Allocator>::__node_holder __tmp_nh;
18911906
// double __xxx = static_cast<double>(__tmp_nh);
18921907

1893-
1894-
/*
1895-
error: cannot convert 'pointer' (aka 'min_pointer<std::__tree_node<std::__value_type<int, double>, min_pointer<void, std::integral_constant<unsigned long, 0>>>>') to 'double' without a conversion operator
1896-
*/
1908+
/*
1909+
error: cannot convert 'pointer' (aka 'min_pointer<std::__tree_node<std::__value_type<int, double>, min_pointer<void,
1910+
std::integral_constant<unsigned long, 0>>>>') to 'double' without a conversion operator
1911+
*/
18971912
// __tree<_Tp, _Compare, _Allocator>::__node_holder __tmp_nh;
18981913
// double __xxx = static_cast<double>(__tmp_nh.get());
18991914

@@ -1906,18 +1921,16 @@ error: cannot convert 'pointer' (aka 'min_pointer<std::__tree_node<std::__value_
19061921
'std::__tree_node_base<min_pointer<void>>'
19071922
*/
19081923

1909-
if(__libcpp_is_constant_evaluated()){
1910-
1911-
typename __tree<_Tp, _Compare, _Allocator>::__node_holder::pointer cast = static_cast<
1912-
__tree<_Tp, _Compare, _Allocator>::__node_holder::pointer>(__h.get());
1913-
__node_base_pointer base = //static_cast<__node_base_pointer>(cast);
1914-
std::__static_fancy_pointer_cast<__node_base_pointer>(cast);
1915-
1924+
if (__libcpp_is_constant_evaluated()) {
1925+
typename __tree<_Tp, _Compare, _Allocator>::__node_holder::pointer cast =
1926+
static_cast< __tree<_Tp, _Compare, _Allocator>::__node_holder::pointer>(__h.get());
1927+
__node_base_pointer base = // static_cast<__node_base_pointer>(cast);
1928+
std::__static_fancy_pointer_cast<__node_base_pointer>(cast);
19161929

1917-
__insert_node_at(__parent, __child, base);
1918-
}else {
1919-
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1920-
}
1930+
__insert_node_at(__parent, __child, base);
1931+
} else {
1932+
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1933+
}
19211934

19221935
__r = __h.release();
19231936
__inserted = true;
@@ -2333,8 +2346,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26
23332346
__rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
23342347
else
23352348
return _Pp(iterator(__rt),
2336-
iterator(__rt->__right_ != nullptr ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
2337-
: __result));
2349+
iterator(__rt->__right_ != nullptr
2350+
? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
2351+
: __result));
23382352
}
23392353
return _Pp(iterator(__result), iterator(__result));
23402354
}
@@ -2356,8 +2370,9 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const {
23562370
else
23572371
return _Pp(
23582372
const_iterator(__rt),
2359-
const_iterator(
2360-
__rt->__right_ != nullptr ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) : __result));
2373+
const_iterator(__rt->__right_ != nullptr
2374+
? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
2375+
: __result));
23612376
}
23622377
return _Pp(const_iterator(__result), const_iterator(__result));
23632378
}

libcxx/include/map

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,9 @@ public:
11181118

11191119
# endif // _LIBCPP_CXX03_LANG
11201120

1121-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); }
1121+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(const value_type& __v) {
1122+
return __tree_.__emplace_unique(__v);
1123+
}
11221124

11231125
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
11241126
return __tree_.__emplace_hint_unique(__p.__i_, __v);
@@ -1817,7 +1819,9 @@ public:
18171819
return __tree_.__emplace_hint_multi(__pos.__i_, std::forward<_Pp>(__p));
18181820
}
18191821

1820-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __v) { return __tree_.__emplace_multi(std::move(__v)); }
1822+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __v) {
1823+
return __tree_.__emplace_multi(std::move(__v));
1824+
}
18211825

18221826
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
18231827
return __tree_.__emplace_hint_multi(__p.__i_, std::move(__v));
@@ -1829,7 +1833,9 @@ public:
18291833

18301834
# endif // _LIBCPP_CXX03_LANG
18311835

1832-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __v) { return __tree_.__emplace_multi(__v); }
1836+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __v) {
1837+
return __tree_.__emplace_multi(__v);
1838+
}
18331839

18341840
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
18351841
return __tree_.__emplace_hint_multi(__p.__i_, __v);

libcxx/test/support/min_allocator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ class min_pointer<const void, ID> {
195195

196196
template <class ID>
197197
class min_pointer<void, ID> {
198-
#ifdef TEST_IS_CONSTANT_EVALUATED
198+
#ifdef TEST_IS_CONSTANT_EVALUATED
199199
ID* ptr_;
200-
#else
200+
#else
201201
void* ptr_;
202-
#endif
202+
#endif
203203

204204
public:
205205
min_pointer() TEST_NOEXCEPT = default;

0 commit comments

Comments
 (0)