[libcxx-commits] [libcxx] 841399a - [libc++] Add custom clang-tidy checks
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 23 06:42:20 PST 2022
Author: Nikolas Klauser
Date: 2022-12-23T15:42:13+01:00
New Revision: 841399a2188aaf244e83e3df7be66885ec905ede
URL: https://github.com/llvm/llvm-project/commit/841399a2188aaf244e83e3df7be66885ec905ede
DIFF: https://github.com/llvm/llvm-project/commit/841399a2188aaf244e83e3df7be66885ec905ede.diff
LOG: [libc++] Add custom clang-tidy checks
Reviewed By: #libc, ldionne
Spies: jwakely, beanz, smeenai, cfe-commits, tschuett, avogelsgesang, Mordante, sstefan1, libcxx-commits, ldionne, mgorny, arichardson, miyuki
Differential Revision: https://reviews.llvm.org/D131963
Added:
libcxx/test/tools/CMakeLists.txt
libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp
libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp
libcxx/test/tools/clang_tidy_checks/robust_against_adl.hpp
Modified:
libcxx/CMakeLists.txt
libcxx/include/__algorithm/ranges_search_n.h
libcxx/include/__algorithm/sort.h
libcxx/include/__bit_reference
libcxx/include/__chrono/duration.h
libcxx/include/__chrono/formatter.h
libcxx/include/__chrono/hh_mm_ss.h
libcxx/include/__chrono/time_point.h
libcxx/include/__compare/common_comparison_category.h
libcxx/include/__compare/partial_order.h
libcxx/include/__compare/strong_order.h
libcxx/include/__compare/weak_order.h
libcxx/include/__filesystem/path.h
libcxx/include/__format/format_arg_store.h
libcxx/include/__format/format_functions.h
libcxx/include/__format/format_string.h
libcxx/include/__format/formatter_floating_point.h
libcxx/include/__format/formatter_integral.h
libcxx/include/__format/formatter_output.h
libcxx/include/__format/parser_std_format_spec.h
libcxx/include/__functional/hash.h
libcxx/include/__hash_table
libcxx/include/__iterator/common_iterator.h
libcxx/include/__iterator/iter_move.h
libcxx/include/__iterator/iter_swap.h
libcxx/include/__locale
libcxx/include/__memory/shared_ptr.h
libcxx/include/__memory/uninitialized_algorithms.h
libcxx/include/__numeric/midpoint.h
libcxx/include/__random/binomial_distribution.h
libcxx/include/__random/uniform_int_distribution.h
libcxx/include/__split_buffer
libcxx/include/__string/char_traits.h
libcxx/include/__type_traits/conjunction.h
libcxx/include/__type_traits/is_callable.h
libcxx/include/__type_traits/is_implicitly_default_constructible.h
libcxx/include/__type_traits/is_valid_expansion.h
libcxx/include/__utility/declval.h
libcxx/include/atomic
libcxx/include/barrier
libcxx/include/charconv
libcxx/include/cmath
libcxx/include/complex
libcxx/include/deque
libcxx/include/experimental/functional
libcxx/include/experimental/simd
libcxx/include/fstream
libcxx/include/future
libcxx/include/iomanip
libcxx/include/ios
libcxx/include/istream
libcxx/include/locale
libcxx/include/mutex
libcxx/include/new
libcxx/include/ostream
libcxx/include/regex
libcxx/include/scoped_allocator
libcxx/include/semaphore
libcxx/include/string
libcxx/include/string_view
libcxx/include/thread
libcxx/include/tuple
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/include/valarray
libcxx/include/variant
libcxx/test/CMakeLists.txt
libcxx/test/configs/cmake-bridge.cfg.in
libcxx/test/libcxx/clang_tidy.sh.cpp
libcxx/utils/ci/buildkite-pipeline.yml
libcxx/utils/ci/run-buildbot
libcxx/utils/libcxx/test/features.py
Removed:
################################################################################
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 454caedcdf3f3..eb71ae89f9fab 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -103,6 +103,7 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
to provide compile-time errors when using features unavailable on some version of
the shared library they shipped should turn this on and see `include/__availability`
for more details." OFF)
+option(LIBCXX_ENABLE_CLANG_TIDY "Whether to compile and run clang-tidy checks" OFF)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in")
@@ -928,6 +929,10 @@ if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
list(APPEND LIBCXX_TEST_DEPS cxx_external_threads)
endif()
+if (LIBCXX_ENABLE_CLANG_TIDY)
+ list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
+endif()
+
if (LIBCXX_INCLUDE_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
diff --git a/libcxx/include/__algorithm/ranges_search_n.h b/libcxx/include/__algorithm/ranges_search_n.h
index f44afde03e99a..56ec8f33d4318 100644
--- a/libcxx/include/__algorithm/ranges_search_n.h
+++ b/libcxx/include/__algorithm/ranges_search_n.h
@@ -53,12 +53,8 @@ struct __fn {
}
if constexpr (random_access_iterator<_Iter1>) {
- auto __ret = __search_n_random_access_impl<_RangeAlgPolicy>(__first, __last,
- __count,
- __value,
- __pred,
- __proj,
- __size);
+ auto __ret = std::__search_n_random_access_impl<_RangeAlgPolicy>(
+ __first, __last, __count, __value, __pred, __proj, __size);
return {std::move(__ret.first), std::move(__ret.second)};
}
}
diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h
index 6242f413a0900..5cb496d2e678e 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -343,7 +343,8 @@ void __insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __l
// Assumes that there is an element in the position (__first - 1) and that each
// element in the input range is greater or equal to the element at __first - 1.
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
-void __insertion_sort_unguarded(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
+_LIBCPP_HIDE_FROM_ABI void
+__insertion_sort_unguarded(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
using _Ops = _IterOps<_AlgPolicy>;
typedef typename iterator_traits<_RandomAccessIterator>::
diff erence_type
diff erence_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
@@ -543,7 +544,7 @@ inline _LIBCPP_HIDE_FROM_ABI void __bitset_partition_partial_blocks(
--__iter;
}
}
- __swap_bitmap_pos<_AlgPolicy, _RandomAccessIterator>(__first, __lm1, __left_bitset, __right_bitset);
+ std::__swap_bitmap_pos<_AlgPolicy, _RandomAccessIterator>(__first, __lm1, __left_bitset, __right_bitset);
__first += (__left_bitset == 0) ? __l_size : 0;
__lm1 -= (__right_bitset == 0) ? __r_size : 0;
}
@@ -636,14 +637,14 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
// Record the comparison outcomes for the elements currently on the left
// side.
if (__left_bitset == 0)
- __populate_left_bitset<_Compare>(__first, __comp, __pivot, __left_bitset);
+ std::__populate_left_bitset<_Compare>(__first, __comp, __pivot, __left_bitset);
// Record the comparison outcomes for the elements currently on the right
// side.
if (__right_bitset == 0)
- __populate_right_bitset<_Compare>(__lm1, __comp, __pivot, __right_bitset);
+ std::__populate_right_bitset<_Compare>(__lm1, __comp, __pivot, __right_bitset);
// Swap the elements recorded to be the candidates for swapping in the
// bitsets.
- __swap_bitmap_pos<_AlgPolicy, _RandomAccessIterator>(__first, __lm1, __left_bitset, __right_bitset);
+ std::__swap_bitmap_pos<_AlgPolicy, _RandomAccessIterator>(__first, __lm1, __left_bitset, __right_bitset);
// Only advance the iterator if all the elements that need to be moved to
// other side were moved.
__first += (__left_bitset == 0) ?
diff erence_type(__detail::__block_size) :
diff erence_type(0);
@@ -651,11 +652,11 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
}
// Now, we have a less-than a block worth of elements on at least one of the
// sides.
- __bitset_partition_partial_blocks<_AlgPolicy, _Compare>(
+ std::__bitset_partition_partial_blocks<_AlgPolicy, _Compare>(
__first, __lm1, __comp, __pivot, __left_bitset, __right_bitset);
// At least one the bitsets would be empty. For the non-empty one, we need to
// properly partition the elements that appear within that bitset.
- __swap_bitmap_pos_within<_AlgPolicy>(__first, __lm1, __left_bitset, __right_bitset);
+ std::__swap_bitmap_pos_within<_AlgPolicy>(__first, __lm1, __left_bitset, __right_bitset);
// Move the pivot to its correct position.
_RandomAccessIterator __pivot_pos = __first -
diff erence_type(1);
@@ -843,15 +844,15 @@ void __introsort(_RandomAccessIterator __first,
// partitioned. This also means that we do not need to sort the left
// side of the partition.
if (!__leftmost && !__comp(*(__first -
diff erence_type(1)), *__first)) {
- __first = __partition_with_equals_on_left<_AlgPolicy, _RandomAccessIterator, _Comp_ref>(
+ __first = std::__partition_with_equals_on_left<_AlgPolicy, _RandomAccessIterator, _Comp_ref>(
__first, __last, _Comp_ref(__comp));
continue;
}
// Use bitset partition only if asked for.
auto __ret =
_UseBitSetPartition
- ? __bitset_partition<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp)
- : __partition_with_equals_on_right<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp);
+ ? std::__bitset_partition<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp)
+ : std::__partition_with_equals_on_right<_AlgPolicy, _RandomAccessIterator, _Compare>(__first, __last, __comp);
_RandomAccessIterator __i = __ret.first;
// [__first, __i) < *__i and *__i <= [__i+1, __last)
// If we were given a perfect partition, see if insertion sort is quick...
@@ -901,7 +902,8 @@ inline _LIBCPP_HIDE_FROM_ABI _Number __log2i(_Number __n) {
template <class _WrappedComp, class _RandomAccessIterator>
_LIBCPP_HIDDEN void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) {
typedef typename iterator_traits<_RandomAccessIterator>::
diff erence_type
diff erence_type;
-
diff erence_type __depth_limit = 2 * __log2i(__last - __first);
+
diff erence_type __depth_limit = 2 * std::__log2i(__last - __first);
+
using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>;
using _AlgPolicy = typename _Unwrap::_AlgPolicy;
using _Compare = typename _Unwrap::_Comp;
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 9ddd4f3bb8180..5f1261bbd7b1f 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -88,7 +88,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
- {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));}
+ {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(std::__libcpp_ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
explicit __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
@@ -163,7 +163,7 @@ public:
{return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
- {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));}
+ {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(std::__libcpp_ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
diff --git a/libcxx/include/__chrono/duration.h b/libcxx/include/__chrono/duration.h
index 4ad6467b2a1d2..7e47b6c4d119b 100644
--- a/libcxx/include/__chrono/duration.h
+++ b/libcxx/include/__chrono/duration.h
@@ -151,7 +151,7 @@ typename enable_if
>::type
floor(const duration<_Rep, _Period>& __d)
{
- _ToDuration __t = duration_cast<_ToDuration>(__d);
+ _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
if (__t > __d)
__t = __t - _ToDuration{1};
return __t;
@@ -166,7 +166,7 @@ typename enable_if
>::type
ceil(const duration<_Rep, _Period>& __d)
{
- _ToDuration __t = duration_cast<_ToDuration>(__d);
+ _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
if (__t < __d)
__t = __t + _ToDuration{1};
return __t;
@@ -181,7 +181,7 @@ typename enable_if
>::type
round(const duration<_Rep, _Period>& __d)
{
- _ToDuration __lower = floor<_ToDuration>(__d);
+ _ToDuration __lower = chrono::floor<_ToDuration>(__d);
_ToDuration __upper = __lower + _ToDuration{1};
auto __lowerDiff = __d - __lower;
auto __upperDiff = __upper - __d;
diff --git a/libcxx/include/__chrono/formatter.h b/libcxx/include/__chrono/formatter.h
index 89c1e82f426a5..de27811f2717f 100644
--- a/libcxx/include/__chrono/formatter.h
+++ b/libcxx/include/__chrono/formatter.h
@@ -195,7 +195,7 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
// FMT honours precision and has a bug for separator
// https://godbolt.org/z/78b7sMxns
if constexpr (chrono::__is_duration<_Tp>::value) {
- __sstr << format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{}"), __value.count());
+ __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{}"), __value.count());
break;
}
__builtin_unreachable();
diff --git a/libcxx/include/__chrono/hh_mm_ss.h b/libcxx/include/__chrono/hh_mm_ss.h
index fde005d097a12..fd61cbe8f8453 100644
--- a/libcxx/include/__chrono/hh_mm_ss.h
+++ b/libcxx/include/__chrono/hh_mm_ss.h
@@ -58,10 +58,10 @@ class hh_mm_ss
_LIBCPP_HIDE_FROM_ABI constexpr explicit hh_mm_ss(_Duration __d) noexcept :
__is_neg_(__d < _Duration(0)),
- __h_(duration_cast<chrono::hours> (abs(__d))),
- __m_(duration_cast<chrono::minutes>(abs(__d) - hours())),
- __s_(duration_cast<chrono::seconds>(abs(__d) - hours() - minutes())),
- __f_(duration_cast<precision> (abs(__d) - hours() - minutes() - seconds()))
+ __h_(chrono::duration_cast<chrono::hours> (chrono::abs(__d))),
+ __m_(chrono::duration_cast<chrono::minutes>(chrono::abs(__d) - hours())),
+ __s_(chrono::duration_cast<chrono::seconds>(chrono::abs(__d) - hours() - minutes())),
+ __f_(chrono::duration_cast<precision> (chrono::abs(__d) - hours() - minutes() - seconds()))
{}
_LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; }
diff --git a/libcxx/include/__chrono/time_point.h b/libcxx/include/__chrono/time_point.h
index cc9c462c9d7f0..52786709d4420 100644
--- a/libcxx/include/__chrono/time_point.h
+++ b/libcxx/include/__chrono/time_point.h
@@ -98,7 +98,7 @@ typename enable_if
>::type
floor(const time_point<_Clock, _Duration>& __t)
{
- return time_point<_Clock, _ToDuration>{floor<_ToDuration>(__t.time_since_epoch())};
+ return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration>
@@ -110,7 +110,7 @@ typename enable_if
>::type
ceil(const time_point<_Clock, _Duration>& __t)
{
- return time_point<_Clock, _ToDuration>{ceil<_ToDuration>(__t.time_since_epoch())};
+ return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration>
@@ -122,7 +122,7 @@ typename enable_if
>::type
round(const time_point<_Clock, _Duration>& __t)
{
- return time_point<_Clock, _ToDuration>{round<_ToDuration>(__t.time_since_epoch())};
+ return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())};
}
template <class _Rep, class _Period>
diff --git a/libcxx/include/__compare/common_comparison_category.h b/libcxx/include/__compare/common_comparison_category.h
index d555058975391..06c4b28491e33 100644
--- a/libcxx/include/__compare/common_comparison_category.h
+++ b/libcxx/include/__compare/common_comparison_category.h
@@ -65,7 +65,7 @@ _LIBCPP_HIDE_FROM_ABI
constexpr auto __get_comp_type() {
using _CCC = _ClassifyCompCategory;
constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...};
- constexpr _CCC _Cat = __compute_comp_type(__type_kinds);
+ constexpr _CCC _Cat = __comp_detail::__compute_comp_type(__type_kinds);
if constexpr (_Cat == _None)
return void();
else if constexpr (_Cat == _PartialOrd)
diff --git a/libcxx/include/__compare/partial_order.h b/libcxx/include/__compare/partial_order.h
index a787bde0a4642..aee07ebb4280e 100644
--- a/libcxx/include/__compare/partial_order.h
+++ b/libcxx/include/__compare/partial_order.h
@@ -29,6 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __partial_order {
struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here
template<class _Tp, class _Up>
requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
_LIBCPP_HIDE_FROM_ABI static constexpr auto
@@ -36,6 +37,7 @@ namespace __partial_order {
noexcept(noexcept(partial_ordering(partial_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))))
-> decltype( partial_ordering(partial_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))
{ return partial_ordering(partial_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))); }
+ // NOLINTEND(libcpp-robust-against-adl)
template<class _Tp, class _Up>
requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
diff --git a/libcxx/include/__compare/strong_order.h b/libcxx/include/__compare/strong_order.h
index 86866912b4c88..05856c2093905 100644
--- a/libcxx/include/__compare/strong_order.h
+++ b/libcxx/include/__compare/strong_order.h
@@ -35,6 +35,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __strong_order {
struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here
template<class _Tp, class _Up>
requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
_LIBCPP_HIDE_FROM_ABI static constexpr auto
@@ -42,6 +43,7 @@ namespace __strong_order {
noexcept(noexcept(strong_ordering(strong_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))))
-> decltype( strong_ordering(strong_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))
{ return strong_ordering(strong_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))); }
+ // NOLINTEND(libcpp-robust-against-adl)
template<class _Tp, class _Up, class _Dp = decay_t<_Tp>>
requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
diff --git a/libcxx/include/__compare/weak_order.h b/libcxx/include/__compare/weak_order.h
index 9d5819d30544c..abb24e3665b5d 100644
--- a/libcxx/include/__compare/weak_order.h
+++ b/libcxx/include/__compare/weak_order.h
@@ -29,6 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [cmp.alg]
namespace __weak_order {
struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here
template<class _Tp, class _Up>
requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
_LIBCPP_HIDE_FROM_ABI static constexpr auto
@@ -36,6 +37,7 @@ namespace __weak_order {
noexcept(noexcept(weak_ordering(weak_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))))
-> decltype( weak_ordering(weak_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))
{ return weak_ordering(weak_order(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))); }
+ // NOLINTEND(libcpp-robust-against-adl)
template<class _Tp, class _Up, class _Dp = decay_t<_Tp>>
requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index 7d1a784403b8d..4e6912fcf3e75 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -619,7 +619,7 @@ class _LIBCPP_TYPE_VIS path {
_EnableIfPathable<_Source> append(const _Source& __src) {
using _Traits = __is_pathable<_Source>;
using _CVT = _PathCVT<_SourceChar<_Source> >;
- bool __source_is_absolute = __is_separator(_Traits::__first_or_null(__src));
+ bool __source_is_absolute = _VSTD_FS::__is_separator(_Traits::__first_or_null(__src));
if (__source_is_absolute)
__pn_.clear();
else if (has_filename())
@@ -634,7 +634,7 @@ class _LIBCPP_TYPE_VIS path {
typedef typename iterator_traits<_InputIt>::value_type _ItVal;
static_assert(__can_convert_char<_ItVal>::value, "Must convertible");
using _CVT = _PathCVT<_ItVal>;
- if (__first != __last && __is_separator(*__first))
+ if (__first != __last && _VSTD_FS::__is_separator(*__first))
__pn_.clear();
else if (has_filename())
__pn_ += preferred_separator;
@@ -866,7 +866,7 @@ class _LIBCPP_TYPE_VIS path {
using _Str = basic_string<_ECharT, _Traits, _Allocator>;
_Str __s(__a);
__s.reserve(__pn_.size());
- _CVT()(back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size());
+ _CVT()(std::back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size());
return __s;
}
diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index 1820c0387c1b5..6f4f4c3617ad4 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -198,7 +198,7 @@ _LIBCPP_HIDE_FROM_ABI void __create_packed_storage(uint64_t& __types, __basic_fo
int __shift = 0;
(
[&] {
- basic_format_arg<_Context> __arg = __create_format_arg<_Context>(__args);
+ basic_format_arg<_Context> __arg = __format::__create_format_arg<_Context>(__args);
if (__shift != 0)
__types |= static_cast<uint64_t>(__arg.__type_) << __shift;
else
@@ -212,7 +212,7 @@ _LIBCPP_HIDE_FROM_ABI void __create_packed_storage(uint64_t& __types, __basic_fo
template <class _Context, class... _Args>
_LIBCPP_HIDE_FROM_ABI void __store_basic_format_arg(basic_format_arg<_Context>* __data, _Args&&... __args) noexcept {
- ([&] { *__data++ = __create_format_arg<_Context>(__args); }(), ...);
+ ([&] { *__data++ = __format::__create_format_arg<_Context>(__args); }(), ...);
}
template <class _Context, size_t N>
diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 7e3afd91bdf77..185148ccba531 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -304,7 +304,7 @@ __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
if (*__begin != _CharT('{')) [[likely]] {
__ctx.advance_to(_VSTD::move(__out_it));
__begin =
- __handle_replacement_field(__begin, __end, __parse_ctx, __ctx);
+ __format::__handle_replacement_field(__begin, __end, __parse_ctx, __ctx);
__out_it = __ctx.out();
// The output is written and __begin points to the next character. So
diff --git a/libcxx/include/__format/format_string.h b/libcxx/include/__format/format_string.h
index dc4e8dfd87208..d9caf866a17d0 100644
--- a/libcxx/include/__format/format_string.h
+++ b/libcxx/include/__format/format_string.h
@@ -73,7 +73,7 @@ __parse_automatic(const _CharT* __begin, const _CharT*, auto& __parse_ctx) {
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_CharT>
__parse_manual(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) {
- __parse_number_result<_CharT> __r = __parse_number(__begin, __end);
+ __parse_number_result<_CharT> __r = __format::__parse_number(__begin, __end);
__parse_ctx.check_arg_id(__r.__value);
return __r;
}
diff --git a/libcxx/include/__format/formatter_floating_point.h b/libcxx/include/__format/formatter_floating_point.h
index 29b3711ef9ebd..a544b53f7e6d7 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -498,7 +498,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
const __float_result& __result,
_VSTD::locale __loc,
__format_spec::__parsed_specifications<_CharT> __specs) {
- const auto& __np = use_facet<numpunct<_CharT>>(__loc);
+ const auto& __np = std::use_facet<numpunct<_CharT>>(__loc);
string __grouping = __np.grouping();
char* __first = __result.__integral;
// When no radix point or exponent are present __last will be __result.__last.
diff --git a/libcxx/include/__format/formatter_integral.h b/libcxx/include/__format/formatter_integral.h
index 87c6d559b08a0..fe3a06311be29 100644
--- a/libcxx/include/__format/formatter_integral.h
+++ b/libcxx/include/__format/formatter_integral.h
@@ -217,7 +217,7 @@ _LIBCPP_HIDE_FROM_ABI auto __format_integer(
# ifndef _LIBCPP_HAS_NO_LOCALIZATION
if (__specs.__std_.__locale_specific_form_) {
- const auto& __np = use_facet<numpunct<_CharT>>(__ctx.locale());
+ const auto& __np = std::use_facet<numpunct<_CharT>>(__ctx.locale());
string __grouping = __np.grouping();
ptr
diff _t __size = __last - __first;
// Writing the grouped form has more overhead than the normal output
@@ -310,7 +310,7 @@ __format_integer(_Tp __value, auto& __ctx, __format_spec::__parsed_specification
auto __r = std::__to_unsigned_like(__value);
bool __negative = __value < 0;
if (__negative)
- __r = __complement(__r);
+ __r = std::__complement(__r);
return __formatter::__format_integer(__r, __ctx, __specs, __negative);
}
@@ -342,7 +342,7 @@ __format_bool(bool __value, auto& __ctx, __format_spec::__parsed_specifications<
-> decltype(__ctx.out()) {
# ifndef _LIBCPP_HAS_NO_LOCALIZATION
if (__specs.__std_.__locale_specific_form_) {
- const auto& __np = use_facet<numpunct<_CharT>>(__ctx.locale());
+ const auto& __np = std::use_facet<numpunct<_CharT>>(__ctx.locale());
basic_string<_CharT> __str = __value ? __np.truename() : __np.falsename();
return __formatter::__write_string_no_precision(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
}
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index adef574c3f459..70eae1564cbcc 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -171,7 +171,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c
} else {
if (__specs.__width_ > __size) {
// Determine padding and write padding.
- __padding = __padding_size(__size, __specs.__width_, __specs.__alignment_);
+ __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__alignment_);
__out_it = __formatter::__fill(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_);
}
@@ -285,7 +285,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_transformed(const _CharT* __first, const _Cha
if (__size >= __specs.__width_)
return __formatter::__transform(__first, __last, _VSTD::move(__out_it), __op);
- __padding_size_result __padding = __padding_size(__size, __specs.__width_, __specs.__alignment_);
+ __padding_size_result __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__alignment_);
__out_it = __formatter::__fill(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_);
__out_it = __formatter::__transform(__first, __last, _VSTD::move(__out_it), __op);
return __formatter::__fill(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_);
@@ -312,7 +312,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros(
_LIBCPP_ASSERT(__num_trailing_zeros > 0, "The overload not writing trailing zeros should have been used");
__padding_size_result __padding =
- __padding_size(__size + __num_trailing_zeros, __specs.__width_, __specs.__alignment_);
+ __formatter::__padding_size(__size + __num_trailing_zeros, __specs.__width_, __specs.__alignment_);
__out_it = __formatter::__fill(_VSTD::move(__out_it), __padding.__before_, __specs.__fill_);
__out_it = __formatter::__copy(__first, __exponent, _VSTD::move(__out_it));
__out_it = __formatter::__fill(_VSTD::move(__out_it), __num_trailing_zeros, _CharT('0'));
@@ -368,7 +368,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_string(
int __size = __formatter::__truncate(__str, __specs.__precision_);
- return __write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __size);
+ return __formatter::__write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __size);
}
# if _LIBCPP_STD_VER > 20
@@ -401,7 +401,7 @@ __write_escaped_code_unit(basic_string<_CharT>& __str, char32_t __value, const _
// lower-case hexadecimal digits.
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI void __write_well_formed_escaped_code_unit(basic_string<_CharT>& __str, char32_t __value) {
- __write_escaped_code_unit(__str, __value, _LIBCPP_STATICALLY_WIDEN(_CharT, "\\u{"));
+ __formatter::__write_escaped_code_unit(__str, __value, _LIBCPP_STATICALLY_WIDEN(_CharT, "\\u{"));
}
// [format.string.escaped]/2.2.3
@@ -411,7 +411,7 @@ _LIBCPP_HIDE_FROM_ABI void __write_well_formed_escaped_code_unit(basic_string<_C
// lower-case hexadecimal digits.
template <class _CharT>
_LIBCPP_HIDE_FROM_ABI void __write_escape_ill_formed_code_unit(basic_string<_CharT>& __str, char32_t __value) {
- __write_escaped_code_unit(__str, __value, _LIBCPP_STATICALLY_WIDEN(_CharT, "\\x{"));
+ __formatter::__write_escaped_code_unit(__str, __value, _LIBCPP_STATICALLY_WIDEN(_CharT, "\\x{"));
}
template <class _CharT>
diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h
index 26d7eb466b8f4..69623c6fe8c61 100644
--- a/libcxx/include/__format/parser_std_format_spec.h
+++ b/libcxx/include/__format/parser_std_format_spec.h
@@ -891,7 +891,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT> __estimate_column_
// unit is non-ASCII we omit the current code unit and let the Grapheme
// clustering algorithm do its work.
const _CharT* __it = __str.begin();
- if (__is_ascii(*__it)) {
+ if (__format_spec::__is_ascii(*__it)) {
do {
--__maximum;
++__it;
@@ -899,12 +899,12 @@ _LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT> __estimate_column_
return {__str.size(), __str.end()};
if (__maximum == 0) {
- if (__is_ascii(*__it))
+ if (__format_spec::__is_ascii(*__it))
return {static_cast<size_t>(__it - __str.begin()), __it};
break;
}
- } while (__is_ascii(*__it));
+ } while (__format_spec::__is_ascii(*__it));
--__it;
++__maximum;
}
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index 6a6d6e79c2287..dfd8ea2553dc8 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -68,7 +68,7 @@ __murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len)
const unsigned char* __data = static_cast<const unsigned char*>(__key);
for (; __len >= 4; __data += 4, __len -= 4)
{
- _Size __k = __loadword<_Size>(__data);
+ _Size __k = std::__loadword<_Size>(__data);
__k *= __m;
__k ^= __k >> __r;
__k *= __m;
@@ -133,13 +133,13 @@ struct __murmur2_or_cityhash<_Size, 64>
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
if (__len > 8) {
- const _Size __a = __loadword<_Size>(__s);
- const _Size __b = __loadword<_Size>(__s + __len - 8);
+ const _Size __a = std::__loadword<_Size>(__s);
+ const _Size __b = std::__loadword<_Size>(__s + __len - 8);
return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b;
}
if (__len >= 4) {
- const uint32_t __a = __loadword<uint32_t>(__s);
- const uint32_t __b = __loadword<uint32_t>(__s + __len - 4);
+ const uint32_t __a = std::__loadword<uint32_t>(__s);
+ const uint32_t __b = std::__loadword<uint32_t>(__s + __len - 4);
return __hash_len_16(__len + (static_cast<_Size>(__a) << 3), __b);
}
if (__len > 0) {
@@ -157,10 +157,10 @@ struct __murmur2_or_cityhash<_Size, 64>
static _Size __hash_len_17_to_32(const char *__s, _Size __len)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
- const _Size __a = __loadword<_Size>(__s) * __k1;
- const _Size __b = __loadword<_Size>(__s + 8);
- const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2;
- const _Size __d = __loadword<_Size>(__s + __len - 16) * __k0;
+ const _Size __a = std::__loadword<_Size>(__s) * __k1;
+ const _Size __b = std::__loadword<_Size>(__s + 8);
+ const _Size __c = std::__loadword<_Size>(__s + __len - 8) * __k2;
+ const _Size __d = std::__loadword<_Size>(__s + __len - 16) * __k0;
return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
__a + __rotate(__b ^ __k3, 20) - __c + __len);
}
@@ -185,10 +185,10 @@ struct __murmur2_or_cityhash<_Size, 64>
const char* __s, _Size __a, _Size __b)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
- return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),
- __loadword<_Size>(__s + 8),
- __loadword<_Size>(__s + 16),
- __loadword<_Size>(__s + 24),
+ return __weak_hash_len_32_with_seeds(std::__loadword<_Size>(__s),
+ std::__loadword<_Size>(__s + 8),
+ std::__loadword<_Size>(__s + 16),
+ std::__loadword<_Size>(__s + 24),
__a,
__b);
}
@@ -197,23 +197,23 @@ struct __murmur2_or_cityhash<_Size, 64>
static _Size __hash_len_33_to_64(const char *__s, size_t __len)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
- _Size __z = __loadword<_Size>(__s + 24);
- _Size __a = __loadword<_Size>(__s) +
- (__len + __loadword<_Size>(__s + __len - 16)) * __k0;
+ _Size __z = std::__loadword<_Size>(__s + 24);
+ _Size __a = std::__loadword<_Size>(__s) +
+ (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0;
_Size __b = __rotate(__a + __z, 52);
_Size __c = __rotate(__a, 37);
- __a += __loadword<_Size>(__s + 8);
+ __a += std::__loadword<_Size>(__s + 8);
__c += __rotate(__a, 7);
- __a += __loadword<_Size>(__s + 16);
+ __a += std::__loadword<_Size>(__s + 16);
_Size __vf = __a + __z;
_Size __vs = __b + __rotate(__a, 31) + __c;
- __a = __loadword<_Size>(__s + 16) + __loadword<_Size>(__s + __len - 32);
- __z += __loadword<_Size>(__s + __len - 8);
+ __a = std::__loadword<_Size>(__s + 16) + std::__loadword<_Size>(__s + __len - 32);
+ __z += std::__loadword<_Size>(__s + __len - 8);
__b = __rotate(__a + __z, 52);
__c = __rotate(__a, 37);
- __a += __loadword<_Size>(__s + __len - 24);
+ __a += std::__loadword<_Size>(__s + __len - 24);
__c += __rotate(__a, 7);
- __a += __loadword<_Size>(__s + __len - 16);
+ __a += std::__loadword<_Size>(__s + __len - 16);
_Size __wf = __a + __z;
_Size __ws = __b + __rotate(__a, 31) + __c;
_Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
@@ -239,26 +239,26 @@ __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
// For strings over 64 bytes we hash the end first, and then as we
// loop we keep 56 bytes of state: v, w, x, y, and z.
- _Size __x = __loadword<_Size>(__s + __len - 40);
- _Size __y = __loadword<_Size>(__s + __len - 16) +
- __loadword<_Size>(__s + __len - 56);
- _Size __z = __hash_len_16(__loadword<_Size>(__s + __len - 48) + __len,
- __loadword<_Size>(__s + __len - 24));
+ _Size __x = std::__loadword<_Size>(__s + __len - 40);
+ _Size __y = std::__loadword<_Size>(__s + __len - 16) +
+ std::__loadword<_Size>(__s + __len - 56);
+ _Size __z = __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len,
+ std::__loadword<_Size>(__s + __len - 24));
pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
- __x = __x * __k1 + __loadword<_Size>(__s);
+ __x = __x * __k1 + std::__loadword<_Size>(__s);
// Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
__len = (__len - 1) & ~static_cast<_Size>(63);
do {
- __x = __rotate(__x + __y + __v.first + __loadword<_Size>(__s + 8), 37) * __k1;
- __y = __rotate(__y + __v.second + __loadword<_Size>(__s + 48), 42) * __k1;
+ __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1;
+ __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1;
__x ^= __w.second;
- __y += __v.first + __loadword<_Size>(__s + 40);
+ __y += __v.first + std::__loadword<_Size>(__s + 40);
__z = __rotate(__z + __w.first, 33) * __k1;
__v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
__w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
- __y + __loadword<_Size>(__s + 16));
+ __y + std::__loadword<_Size>(__s + 16));
_VSTD::swap(__z, __x);
__s += 64;
__len -= 64;
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index d6af75e9e0f03..f3ad4cdb5965c 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -565,7 +565,7 @@ public:
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to increment a non-incrementable unordered container local_iterator");
__node_ = __node_->__next_;
- if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
+ if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
__node_ = nullptr;
return *this;
}
@@ -698,7 +698,7 @@ public:
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to increment a non-incrementable unordered container const_local_iterator");
__node_ = __node_->__next_;
- if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
+ if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
__node_ = nullptr;
return *this;
}
@@ -1156,11 +1156,11 @@ public:
_LIBCPP_INLINE_VISIBILITY void __rehash_multi(size_type __n) { __rehash<false>(__n); }
_LIBCPP_INLINE_VISIBILITY void __reserve_unique(size_type __n)
{
- __rehash_unique(static_cast<size_type>(ceil(__n / max_load_factor())));
+ __rehash_unique(static_cast<size_type>(std::ceil(__n / max_load_factor())));
}
_LIBCPP_INLINE_VISIBILITY void __reserve_multi(size_type __n)
{
- __rehash_multi(static_cast<size_type>(ceil(__n / max_load_factor())));
+ __rehash_multi(static_cast<size_type>(std::ceil(__n / max_load_factor())));
}
_LIBCPP_INLINE_VISIBILITY
@@ -1184,7 +1184,7 @@ public:
{
_LIBCPP_ASSERT(bucket_count() > 0,
"unordered container::bucket(key) called when bucket_count() == 0");
- return __constrain_hash(hash_function()(__k), bucket_count());
+ return std::__constrain_hash(hash_function()(__k), bucket_count());
}
template <class _Key>
@@ -1433,7 +1433,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
{
if (size() > 0)
{
- __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
__p1_.first().__ptr();
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
@@ -1457,7 +1457,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
{
__p1_.first().__next_ = __u.__p1_.first().__next_;
__u.__p1_.first().__next_ = nullptr;
- __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
__p1_.first().__ptr();
size() = __u.size();
__u.size() = 0;
@@ -1574,7 +1574,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__p1_.first().__next_ = __u.__p1_.first().__next_;
if (size() > 0)
{
- __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
__p1_.first().__ptr();
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
@@ -1789,12 +1789,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(
if (__bc != 0)
{
- size_t __chash = __constrain_hash(__hash, __bc);
+ size_t __chash = std::__constrain_hash(__hash, __bc);
__next_pointer __ndptr = __bucket_list_[__chash];
if (__ndptr != nullptr)
{
for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
- __constrain_hash(__ndptr->__hash(), __bc) == __chash;
+ std::__constrain_hash(__ndptr->__hash(), __bc) == __chash;
__ndptr = __ndptr->__next_)
{
if (key_eq()(__ndptr->__upcast()->__value_, __value))
@@ -1804,8 +1804,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(
}
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- __rehash_unique(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
- size_type(ceil(float(size() + 1) / max_load_factor()))));
+ __rehash_unique(_VSTD::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
+ size_type(std::ceil(float(size() + 1) / max_load_factor()))));
}
return nullptr;
}
@@ -1821,7 +1821,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform(
__node_pointer __nd) _NOEXCEPT
{
size_type __bc = bucket_count();
- size_t __chash = __constrain_hash(__nd->__hash(), __bc);
+ size_t __chash = std::__constrain_hash(__nd->__hash(), __bc);
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
__next_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
@@ -1832,7 +1832,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform(
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__nd->__next_ != nullptr)
- __bucket_list_[__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr();
+ __bucket_list_[std::__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr();
}
else
{
@@ -1876,16 +1876,16 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(
size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- __rehash_multi(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
- size_type(ceil(float(size() + 1) / max_load_factor()))));
+ __rehash_multi(_VSTD::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
+ size_type(std::ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
- size_t __chash = __constrain_hash(__cp_hash, __bc);
+ size_t __chash = std::__constrain_hash(__cp_hash, __bc);
__next_pointer __pn = __bucket_list_[__chash];
if (__pn != nullptr)
{
for (bool __found = false; __pn->__next_ != nullptr &&
- __constrain_hash(__pn->__next_->__hash(), __bc) == __chash;
+ std::__constrain_hash(__pn->__next_->__hash(), __bc) == __chash;
__pn = __pn->__next_)
{
// __found key_eq() action
@@ -1917,7 +1917,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform(
__node_pointer __cp, __next_pointer __pn) _NOEXCEPT
{
size_type __bc = bucket_count();
- size_t __chash = __constrain_hash(__cp->__hash_, __bc);
+ size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
if (__pn == nullptr)
{
__pn =__p1_.first().__ptr();
@@ -1926,7 +1926,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform(
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__cp->__next_ != nullptr)
- __bucket_list_[__constrain_hash(__cp->__next_->__hash(), __bc)]
+ __bucket_list_[std::__constrain_hash(__cp->__next_->__hash(), __bc)]
= __cp->__ptr();
}
else
@@ -1935,7 +1935,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform(
__pn->__next_ = __cp->__ptr();
if (__cp->__next_ != nullptr)
{
- size_t __nhash = __constrain_hash(__cp->__next_->__hash(), __bc);
+ size_t __nhash = std::__constrain_hash(__cp->__next_->__hash(), __bc);
if (__nhash != __chash)
__bucket_list_[__nhash] = __cp->__ptr();
}
@@ -1970,11 +1970,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- __rehash_multi(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
- size_type(ceil(float(size() + 1) / max_load_factor()))));
+ __rehash_multi(_VSTD::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
+ size_type(std::ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
- size_t __chash = __constrain_hash(__cp->__hash_, __bc);
+ size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
__next_pointer __pp = __bucket_list_[__chash];
while (__pp->__next_ != __np)
__pp = __pp->__next_;
@@ -2001,12 +2001,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
size_t __chash;
if (__bc != 0)
{
- __chash = __constrain_hash(__hash, __bc);
+ __chash = std::__constrain_hash(__hash, __bc);
__nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
- (__nd->__hash() == __hash || __constrain_hash(__nd->__hash(), __bc) == __chash);
+ (__nd->__hash() == __hash || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
__nd = __nd->__next_)
{
if (key_eq()(__nd->__upcast()->__value_, __k))
@@ -2018,10 +2018,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
__node_holder __h = __construct_node_hash(__hash, _VSTD::forward<_Args>(__args)...);
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- __rehash_unique(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
- size_type(ceil(float(size() + 1) / max_load_factor()))));
+ __rehash_unique(_VSTD::max<size_type>(2 * __bc + !std::__is_hash_power2(__bc),
+ size_type(std::ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
- __chash = __constrain_hash(__hash, __bc);
+ __chash = std::__constrain_hash(__hash, __bc);
}
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
__next_pointer __pn = __bucket_list_[__chash];
@@ -2033,7 +2033,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__h->__next_ != nullptr)
- __bucket_list_[__constrain_hash(__h->__next_->__hash(), __bc)]
+ __bucket_list_[std::__constrain_hash(__h->__next_->__hash(), __bc)]
= __h.get()->__ptr();
}
else
@@ -2229,7 +2229,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
if (__n == 1)
__n = 2;
else if (__n & (__n - 1))
- __n = __next_prime(__n);
+ __n = std::__next_prime(__n);
size_type __bc = bucket_count();
if (__n > __bc)
__do_rehash<_UniqueKeys>(__n);
@@ -2238,8 +2238,8 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
__n = _VSTD::max<size_type>
(
__n,
- __is_hash_power2(__bc) ? __next_hash_pow2(size_t(ceil(float(size()) / max_load_factor()))) :
- __next_prime(size_t(ceil(float(size()) / max_load_factor())))
+ std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(std::ceil(float(size()) / max_load_factor()))) :
+ std::__next_prime(size_t(std::ceil(float(size()) / max_load_factor())))
);
if (__n < __bc)
__do_rehash<_UniqueKeys>(__n);
@@ -2264,13 +2264,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc)
__next_pointer __cp = __pp->__next_;
if (__cp != nullptr)
{
- size_type __chash = __constrain_hash(__cp->__hash(), __nbc);
+ size_type __chash = std::__constrain_hash(__cp->__hash(), __nbc);
__bucket_list_[__chash] = __pp;
size_type __phash = __chash;
for (__pp = __cp, void(), __cp = __cp->__next_; __cp != nullptr;
__cp = __pp->__next_)
{
- __chash = __constrain_hash(__cp->__hash(), __nbc);
+ __chash = std::__constrain_hash(__cp->__hash(), __nbc);
if (__chash == __phash)
__pp = __cp;
else
@@ -2312,13 +2312,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
size_type __bc = bucket_count();
if (__bc != 0)
{
- size_t __chash = __constrain_hash(__hash, __bc);
+ size_t __chash = std::__constrain_hash(__hash, __bc);
__next_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
(__nd->__hash() == __hash
- || __constrain_hash(__nd->__hash(), __bc) == __chash);
+ || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
__nd = __nd->__next_)
{
if ((__nd->__hash() == __hash)
@@ -2339,13 +2339,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
size_type __bc = bucket_count();
if (__bc != 0)
{
- size_t __chash = __constrain_hash(__hash, __bc);
+ size_t __chash = std::__constrain_hash(__hash, __bc);
__next_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
(__hash == __nd->__hash()
- || __constrain_hash(__nd->__hash(), __bc) == __chash);
+ || std::__constrain_hash(__nd->__hash(), __bc) == __chash);
__nd = __nd->__next_)
{
if ((__nd->__hash() == __hash)
@@ -2467,7 +2467,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
// current node
__next_pointer __cn = __p.__node_;
size_type __bc = bucket_count();
- size_t __chash = __constrain_hash(__cn->__hash(), __bc);
+ size_t __chash = std::__constrain_hash(__cn->__hash(), __bc);
// find previous node
__next_pointer __pn = __bucket_list_[__chash];
for (; __pn->__next_ != __cn; __pn = __pn->__next_)
@@ -2476,16 +2476,16 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
// if __pn is not in same bucket (before begin is not in same bucket) &&
// if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
if (__pn == __p1_.first().__ptr()
- || __constrain_hash(__pn->__hash(), __bc) != __chash)
+ || std::__constrain_hash(__pn->__hash(), __bc) != __chash)
{
if (__cn->__next_ == nullptr
- || __constrain_hash(__cn->__next_->__hash(), __bc) != __chash)
+ || std::__constrain_hash(__cn->__next_->__hash(), __bc) != __chash)
__bucket_list_[__chash] = nullptr;
}
// if __cn->__next_ is not in same bucket (nullptr is in same bucket)
if (__cn->__next_ != nullptr)
{
- size_t __nhash = __constrain_hash(__cn->__next_->__hash(), __bc);
+ size_t __nhash = std::__constrain_hash(__cn->__next_->__hash(), __bc);
if (__nhash != __chash)
__bucket_list_[__nhash] = __pn;
}
@@ -2639,10 +2639,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
__p2_.swap(__u.__p2_);
__p3_.swap(__u.__p3_);
if (size() > 0)
- __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
+ __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] =
__p1_.first().__ptr();
if (__u.size() > 0)
- __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
+ __u.__bucket_list_[std::__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
__u.__p1_.first().__ptr();
std::__debug_db_swap(this, std::addressof(__u));
}
@@ -2659,8 +2659,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const
if (__np != nullptr)
{
for (__np = __np->__next_; __np != nullptr &&
- __constrain_hash(__np->__hash(), __bc) == __n;
- __np = __np->__next_, (void) ++__r)
+ std::__constrain_hash(__np->__hash(), __bc) == __n;
+ __np = __np->__next_, (void) ++__r)
;
}
return __r;
diff --git a/libcxx/include/__iterator/common_iterator.h b/libcxx/include/__iterator/common_iterator.h
index a1985c9287534..d0947bbd07f35 100644
--- a/libcxx/include/__iterator/common_iterator.h
+++ b/libcxx/include/__iterator/common_iterator.h
@@ -101,14 +101,14 @@ class common_iterator {
constexpr decltype(auto) operator*()
{
- _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
return *_VSTD::__unchecked_get<_Iter>(__hold_);
}
constexpr decltype(auto) operator*() const
requires __dereferenceable<const _Iter>
{
- _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
return *_VSTD::__unchecked_get<_Iter>(__hold_);
}
@@ -119,7 +119,7 @@ class common_iterator {
is_reference_v<iter_reference_t<_I2>> ||
constructible_from<iter_value_t<_I2>, iter_reference_t<_I2>>)
{
- _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
if constexpr (is_pointer_v<_Iter> || requires(const _Iter& __i) { __i.operator->(); }) {
return _VSTD::__unchecked_get<_Iter>(__hold_);
} else if constexpr (is_reference_v<iter_reference_t<_Iter>>) {
@@ -131,12 +131,12 @@ class common_iterator {
}
common_iterator& operator++() {
- _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
++_VSTD::__unchecked_get<_Iter>(__hold_); return *this;
}
decltype(auto) operator++(int) {
- _LIBCPP_ASSERT(holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
if constexpr (forward_iterator<_Iter>) {
auto __tmp = *this;
++*this;
@@ -218,7 +218,7 @@ class common_iterator {
noexcept(noexcept(ranges::iter_move(declval<const _Iter&>())))
requires input_iterator<_Iter>
{
- _LIBCPP_ASSERT(holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator");
return ranges::iter_move( _VSTD::__unchecked_get<_Iter>(__i.__hold_));
}
@@ -226,8 +226,8 @@ class common_iterator {
_LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y)
noexcept(noexcept(ranges::iter_swap(declval<const _Iter&>(), declval<const _I2&>())))
{
- _LIBCPP_ASSERT(holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
- _LIBCPP_ASSERT(holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
+ _LIBCPP_ASSERT(std::holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
return ranges::iter_swap(_VSTD::__unchecked_get<_Iter>(__x.__hold_), _VSTD::__unchecked_get<_I2>(__y.__hold_));
}
};
diff --git a/libcxx/include/__iterator/iter_move.h b/libcxx/include/__iterator/iter_move.h
index 0d611bb4a8667..d8ab48af754df 100644
--- a/libcxx/include/__iterator/iter_move.h
+++ b/libcxx/include/__iterator/iter_move.h
@@ -38,6 +38,7 @@ template <class _Tp>
concept __unqualified_iter_move =
__class_or_enum<remove_cvref_t<_Tp>> &&
requires (_Tp&& __t) {
+ // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
iter_move(std::forward<_Tp>(__t));
};
@@ -61,6 +62,7 @@ concept __just_deref =
// [iterator.cust.move]
struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) iter_move ADL calls should only be made through ranges::iter_move
template<class _Ip>
requires __unqualified_iter_move<_Ip>
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Ip&& __i) const
@@ -68,6 +70,7 @@ struct __fn {
{
return iter_move(std::forward<_Ip>(__i));
}
+ // NOLINTEND(libcpp-robust-against-adl)
template<class _Ip>
requires __move_deref<_Ip>
diff --git a/libcxx/include/__iterator/iter_swap.h b/libcxx/include/__iterator/iter_swap.h
index e5e22dd8c3bbb..5cc4272e16041 100644
--- a/libcxx/include/__iterator/iter_swap.h
+++ b/libcxx/include/__iterator/iter_swap.h
@@ -41,6 +41,7 @@ namespace __iter_swap {
concept __unqualified_iter_swap =
(__class_or_enum<remove_cvref_t<_T1>> || __class_or_enum<remove_cvref_t<_T2>>) &&
requires (_T1&& __x, _T2&& __y) {
+ // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
iter_swap(_VSTD::forward<_T1>(__x), _VSTD::forward<_T2>(__y));
};
@@ -49,7 +50,9 @@ namespace __iter_swap {
indirectly_readable<_T1> && indirectly_readable<_T2> &&
swappable_with<iter_reference_t<_T1>, iter_reference_t<_T2>>;
+
struct __fn {
+ // NOLINTBEGIN(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
template <class _T1, class _T2>
requires __unqualified_iter_swap<_T1, _T2>
_LIBCPP_HIDE_FROM_ABI
@@ -58,6 +61,7 @@ namespace __iter_swap {
{
(void)iter_swap(_VSTD::forward<_T1>(__x), _VSTD::forward<_T2>(__y));
}
+ // NOLINTEND(libcpp-robust-against-adl)
template <class _T1, class _T2>
requires (!__unqualified_iter_swap<_T1, _T2>) &&
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index f1e0a07fd06b6..e0ffa0ca00ffe 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -843,7 +843,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
isspace(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
}
template <class _CharT>
@@ -851,7 +851,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
isprint(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
}
template <class _CharT>
@@ -859,7 +859,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
iscntrl(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
}
template <class _CharT>
@@ -867,7 +867,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
isupper(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
}
template <class _CharT>
@@ -875,7 +875,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
islower(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
}
template <class _CharT>
@@ -883,7 +883,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
isalpha(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
}
template <class _CharT>
@@ -891,7 +891,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
isdigit(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
}
template <class _CharT>
@@ -899,7 +899,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
ispunct(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
}
template <class _CharT>
@@ -907,7 +907,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
isxdigit(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
}
template <class _CharT>
@@ -915,7 +915,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
isalnum(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
}
template <class _CharT>
@@ -923,7 +923,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
isgraph(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
+ return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
}
template <class _CharT>
@@ -931,7 +931,7 @@ inline _LIBCPP_INLINE_VISIBILITY
_CharT
toupper(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).toupper(__c);
+ return std::use_facet<ctype<_CharT> >(__loc).toupper(__c);
}
template <class _CharT>
@@ -939,7 +939,7 @@ inline _LIBCPP_INLINE_VISIBILITY
_CharT
tolower(_CharT __c, const locale& __loc)
{
- return use_facet<ctype<_CharT> >(__loc).tolower(__c);
+ return std::use_facet<ctype<_CharT> >(__loc).tolower(__c);
}
// codecvt_base
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index f8b9ee2bccdca..e200a959fa295 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -381,7 +381,7 @@ template <class, class>
static false_type __well_formed_deleter_test(...);
template <class _Dp, class _Pt>
-struct __well_formed_deleter : decltype(__well_formed_deleter_test<_Dp, _Pt>(0)) {};
+struct __well_formed_deleter : decltype(std::__well_formed_deleter_test<_Dp, _Pt>(0)) {};
template<class _Dp, class _Tp, class _Yp>
struct __shared_ptr_deleter_ctor_reqs
@@ -1809,7 +1809,7 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
atomic_load(const shared_ptr<_Tp>* __p)
{
- __sp_mut& __m = __get_sp_mut(__p);
+ __sp_mut& __m = std::__get_sp_mut(__p);
__m.lock();
shared_ptr<_Tp> __q = *__p;
__m.unlock();
@@ -1822,7 +1822,7 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
shared_ptr<_Tp>
atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
{
- return atomic_load(__p);
+ return std::atomic_load(__p);
}
template <class _Tp>
@@ -1830,7 +1830,7 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
_LIBCPP_HIDE_FROM_ABI void
atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
{
- __sp_mut& __m = __get_sp_mut(__p);
+ __sp_mut& __m = std::__get_sp_mut(__p);
__m.lock();
__p->swap(__r);
__m.unlock();
@@ -1842,7 +1842,7 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
void
atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
{
- atomic_store(__p, __r);
+ std::atomic_store(__p, __r);
}
template <class _Tp>
@@ -1850,7 +1850,7 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>
atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
{
- __sp_mut& __m = __get_sp_mut(__p);
+ __sp_mut& __m = std::__get_sp_mut(__p);
__m.lock();
__p->swap(__r);
__m.unlock();
@@ -1863,7 +1863,7 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
shared_ptr<_Tp>
atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
{
- return atomic_exchange(__p, __r);
+ return std::atomic_exchange(__p, __r);
}
template <class _Tp>
@@ -1872,7 +1872,7 @@ _LIBCPP_HIDE_FROM_ABI bool
atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
{
shared_ptr<_Tp> __temp;
- __sp_mut& __m = __get_sp_mut(__p);
+ __sp_mut& __m = std::__get_sp_mut(__p);
__m.lock();
if (__p->__owner_equivalent(*__v))
{
@@ -1893,7 +1893,7 @@ _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
bool
atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
{
- return atomic_compare_exchange_strong(__p, __v, __w);
+ return std::atomic_compare_exchange_strong(__p, __v, __w);
}
template <class _Tp>
@@ -1903,7 +1903,7 @@ bool
atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
shared_ptr<_Tp> __w, memory_order, memory_order)
{
- return atomic_compare_exchange_strong(__p, __v, __w);
+ return std::atomic_compare_exchange_strong(__p, __v, __w);
}
template <class _Tp>
@@ -1913,7 +1913,7 @@ bool
atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
shared_ptr<_Tp> __w, memory_order, memory_order)
{
- return atomic_compare_exchange_weak(__p, __v, __w);
+ return std::atomic_compare_exchange_weak(__p, __v, __w);
}
#endif // !defined(_LIBCPP_HAS_NO_THREADS)
diff --git a/libcxx/include/__memory/uninitialized_algorithms.h b/libcxx/include/__memory/uninitialized_algorithms.h
index 213428bc7a18b..ed6cc4ca5a841 100644
--- a/libcxx/include/__memory/uninitialized_algorithms.h
+++ b/libcxx/include/__memory/uninitialized_algorithms.h
@@ -293,7 +293,7 @@ template <class _ForwardIterator, class _Size>
inline _LIBCPP_HIDE_FROM_ABI
_ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
- return __uninitialized_value_construct_n<_ValueType>(_VSTD::move(__first), __n);
+ return std::__uninitialized_value_construct_n<_ValueType>(_VSTD::move(__first), __n);
}
// uninitialized_move
diff --git a/libcxx/include/__numeric/midpoint.h b/libcxx/include/__numeric/midpoint.h
index d8cce7929bf79..ada6adf728837 100644
--- a/libcxx/include/__numeric/midpoint.h
+++ b/libcxx/include/__numeric/midpoint.h
@@ -69,10 +69,10 @@ midpoint(_Fp __a, _Fp __b) noexcept
{
constexpr _Fp __lo = numeric_limits<_Fp>::min()*2;
constexpr _Fp __hi = numeric_limits<_Fp>::max()/2;
- return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible
+ return std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi ? // typical case: overflow is impossible
(__a + __b)/2 : // always correctly rounded
- __fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a
- __fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b
+ std::__fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a
+ std::__fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b
__a/2 + __b/2; // otherwise correctly rounded
}
diff --git a/libcxx/include/__random/binomial_distribution.h b/libcxx/include/__random/binomial_distribution.h
index 28f176e14f0d2..7b0f055d50680 100644
--- a/libcxx/include/__random/binomial_distribution.h
+++ b/libcxx/include/__random/binomial_distribution.h
@@ -133,9 +133,9 @@ binomial_distribution<_IntType>::param_type::param_type(result_type __t, double
if (0 < __p_ && __p_ < 1)
{
__r0_ = static_cast<result_type>((__t_ + 1) * __p_);
- __pr_ = _VSTD::exp(__libcpp_lgamma(__t_ + 1.) -
- __libcpp_lgamma(__r0_ + 1.) -
- __libcpp_lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) +
+ __pr_ = _VSTD::exp(std::__libcpp_lgamma(__t_ + 1.) -
+ std::__libcpp_lgamma(__r0_ + 1.) -
+ std::__libcpp_lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) +
(__t_ - __r0_) * _VSTD::log(1 - __p_));
__odds_ratio_ = __p_ / (1 - __p_);
}
diff --git a/libcxx/include/__random/uniform_int_distribution.h b/libcxx/include/__random/uniform_int_distribution.h
index e9930e857522a..f36a7c25fc08d 100644
--- a/libcxx/include/__random/uniform_int_distribution.h
+++ b/libcxx/include/__random/uniform_int_distribution.h
@@ -242,7 +242,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
if (_Rp == 0)
return static_cast<result_type>(_Eng(__g, _Dt)());
- size_t __w = _Dt - __countl_zero(_Rp) - 1;
+ size_t __w = _Dt - std::__countl_zero(_Rp) - 1;
if ((_Rp & (numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0)
++__w;
_Eng __e(__g, __w);
diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer
index 823487318ee9b..7d0beda277ada 100644
--- a/libcxx/include/__split_buffer
+++ b/libcxx/include/__split_buffer
@@ -500,7 +500,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
}
else
{
- size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -530,7 +530,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
}
else
{
- size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -562,7 +562,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
}
else
{
- size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -592,7 +592,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
}
else
{
- size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -624,7 +624,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
}
else
{
- size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
+ size_type __c = std::max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
diff --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h
index 98dcc2491547a..622ee224f1a06 100644
--- a/libcxx/include/__string/char_traits.h
+++ b/libcxx/include/__string/char_traits.h
@@ -671,7 +671,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
if (__n == 0) // There is nothing to search, just return __pos.
return __pos;
- const _CharT *__r = __search_substring<_CharT, _Traits>(
+ const _CharT *__r = std::__search_substring<_CharT, _Traits>(
__p + __pos, __p + __sz, __s, __s + __n);
if (__r == __p + __sz)
diff --git a/libcxx/include/__type_traits/conjunction.h b/libcxx/include/__type_traits/conjunction.h
index 2802d284527b0..0d95347e99888 100644
--- a/libcxx/include/__type_traits/conjunction.h
+++ b/libcxx/include/__type_traits/conjunction.h
@@ -35,7 +35,7 @@ false_type __and_helper(...);
// be instantiated) since it is an alias, unlike `conjunction<_Pred...>`, which is a struct.
// If you want to defer the evaluation of `_And<_Pred...>` itself, use `_Lazy<_And, _Pred...>`.
template <class... _Pred>
-using _And _LIBCPP_NODEBUG = decltype(__and_helper<_Pred...>(0));
+using _And _LIBCPP_NODEBUG = decltype(std::__and_helper<_Pred...>(0));
#if _LIBCPP_STD_VER > 14
diff --git a/libcxx/include/__type_traits/is_callable.h b/libcxx/include/__type_traits/is_callable.h
index 73f894dce94c3..445373c43b9d4 100644
--- a/libcxx/include/__type_traits/is_callable.h
+++ b/libcxx/include/__type_traits/is_callable.h
@@ -25,7 +25,7 @@ template<class...>
false_type __is_callable_helper(...);
template<class _Func, class... _Args>
-struct __is_callable : decltype(__is_callable_helper<_Func, _Args...>(0)) {};
+struct __is_callable : decltype(std::__is_callable_helper<_Func, _Args...>(0)) {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_implicitly_default_constructible.h b/libcxx/include/__type_traits/is_implicitly_default_constructible.h
index 3643897a2d6da..b77f94845fde0 100644
--- a/libcxx/include/__type_traits/is_implicitly_default_constructible.h
+++ b/libcxx/include/__type_traits/is_implicitly_default_constructible.h
@@ -33,12 +33,12 @@ struct __is_implicitly_default_constructible
{ };
template <class _Tp>
-struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true_type>
+struct __is_implicitly_default_constructible<_Tp, decltype(std::__test_implicit_default_constructible<_Tp const&>({})), true_type>
: true_type
{ };
template <class _Tp>
-struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false_type>
+struct __is_implicitly_default_constructible<_Tp, decltype(std::__test_implicit_default_constructible<_Tp const&>({})), false_type>
: false_type
{ };
#endif // !C++03
diff --git a/libcxx/include/__type_traits/is_valid_expansion.h b/libcxx/include/__type_traits/is_valid_expansion.h
index c45db7509e41f..db7d7e5f1d057 100644
--- a/libcxx/include/__type_traits/is_valid_expansion.h
+++ b/libcxx/include/__type_traits/is_valid_expansion.h
@@ -24,7 +24,7 @@ template <template <class...> class, class ...>
false_type __sfinae_test_impl(...);
template <template <class ...> class _Templ, class ..._Args>
-using _IsValidExpansion _LIBCPP_NODEBUG = decltype(__sfinae_test_impl<_Templ, _Args...>(0));
+using _IsValidExpansion _LIBCPP_NODEBUG = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0));
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__utility/declval.h b/libcxx/include/__utility/declval.h
index 97fd1eba91c68..c2f4bec132827 100644
--- a/libcxx/include/__utility/declval.h
+++ b/libcxx/include/__utility/declval.h
@@ -27,7 +27,7 @@ _Tp __declval(long);
_LIBCPP_SUPPRESS_DEPRECATED_POP
template <class _Tp>
-decltype(__declval<_Tp>(0)) declval() _NOEXCEPT;
+decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT;
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index fac146537d9a2..87631f39f6ae3 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -1452,10 +1452,10 @@ struct __libcpp_atomic_wait_backoff_impl {
{
if(__elapsed > chrono::microseconds(64))
{
- auto const __monitor = __libcpp_atomic_monitor(__a);
+ auto const __monitor = std::__libcpp_atomic_monitor(__a);
if(__test_fn())
return true;
- __libcpp_atomic_wait(__a, __monitor);
+ std::__libcpp_atomic_wait(__a, __monitor);
}
else if(__elapsed > chrono::microseconds(4))
__libcpp_thread_yield();
@@ -1470,7 +1470,7 @@ _LIBCPP_AVAILABILITY_SYNC
_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn)
{
__libcpp_atomic_wait_backoff_impl<_Atp, typename decay<_Fn>::type> __backoff_fn = {__a, __test_fn};
- return __libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn);
+ return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn);
}
#else // _LIBCPP_HAS_NO_THREADS
@@ -1494,7 +1494,7 @@ struct __cxx_atomic_wait_test_fn_impl {
memory_order __order;
_LIBCPP_INLINE_VISIBILITY bool operator()() const
{
- return !__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val);
+ return !std::__cxx_nonatomic_compare_equal(std::__cxx_atomic_load(__a, __order), __val);
}
};
@@ -1503,7 +1503,7 @@ _LIBCPP_AVAILABILITY_SYNC
_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order)
{
__cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order};
- return __cxx_atomic_wait(__a, __test_fn);
+ return std::__cxx_atomic_wait(__a, __test_fn);
}
// general atomic<T>
@@ -1526,78 +1526,78 @@ struct __atomic_base // false
_LIBCPP_INLINE_VISIBILITY
void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
- {__cxx_atomic_store(&__a_, __d, __m);}
+ {std::__cxx_atomic_store(&__a_, __d, __m);}
_LIBCPP_INLINE_VISIBILITY
void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
- {__cxx_atomic_store(&__a_, __d, __m);}
+ {std::__cxx_atomic_store(&__a_, __d, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
- {return __cxx_atomic_load(&__a_, __m);}
+ {return std::__cxx_atomic_load(&__a_, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
- {return __cxx_atomic_load(&__a_, __m);}
+ {return std::__cxx_atomic_load(&__a_, __m);}
_LIBCPP_INLINE_VISIBILITY
operator _Tp() const volatile _NOEXCEPT {return load();}
_LIBCPP_INLINE_VISIBILITY
operator _Tp() const _NOEXCEPT {return load();}
_LIBCPP_INLINE_VISIBILITY
_Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_exchange(&__a_, __d, __m);}
+ {return std::__cxx_atomic_exchange(&__a_, __d, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_exchange(&__a_, __d, __m);}
+ {return std::__cxx_atomic_exchange(&__a_, __d, __m);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_weak(_Tp& __e, _Tp __d,
memory_order __s, memory_order __f) volatile _NOEXCEPT
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
- {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
+ {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_weak(_Tp& __e, _Tp __d,
memory_order __s, memory_order __f) _NOEXCEPT
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
- {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
+ {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_strong(_Tp& __e, _Tp __d,
memory_order __s, memory_order __f) volatile _NOEXCEPT
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
- {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
+ {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_strong(_Tp& __e, _Tp __d,
memory_order __s, memory_order __f) _NOEXCEPT
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
- {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
+ {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_weak(_Tp& __e, _Tp __d,
memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
+ {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_weak(_Tp& __e, _Tp __d,
memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
+ {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_strong(_Tp& __e, _Tp __d,
memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
+ {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_strong(_Tp& __e, _Tp __d,
memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
+ {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
- {__cxx_atomic_wait(&__a_, __v, __m);}
+ {std::__cxx_atomic_wait(&__a_, __v, __m);}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT
- {__cxx_atomic_wait(&__a_, __v, __m);}
+ {std::__cxx_atomic_wait(&__a_, __v, __m);}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_one() volatile _NOEXCEPT
- {__cxx_atomic_notify_one(&__a_);}
+ {std::__cxx_atomic_notify_one(&__a_);}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_one() _NOEXCEPT
- {__cxx_atomic_notify_one(&__a_);}
+ {std::__cxx_atomic_notify_one(&__a_);}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_all() volatile _NOEXCEPT
- {__cxx_atomic_notify_all(&__a_);}
+ {std::__cxx_atomic_notify_all(&__a_);}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_all() _NOEXCEPT
- {__cxx_atomic_notify_all(&__a_);}
+ {std::__cxx_atomic_notify_all(&__a_);}
#if _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY constexpr
@@ -1634,34 +1634,34 @@ struct __atomic_base<_Tp, true>
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_and(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_and(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_or(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_or(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
- {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
- {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
+ {return std::__cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));}
@@ -1760,28 +1760,28 @@ struct atomic<_Tp*>
_Tp* fetch_add(ptr
diff _t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
// __atomic_fetch_add accepts function pointers, guard against them.
static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return __cxx_atomic_fetch_add(&this->__a_, __op, __m);
+ return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m);
}
_LIBCPP_INLINE_VISIBILITY
_Tp* fetch_add(ptr
diff _t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
// __atomic_fetch_add accepts function pointers, guard against them.
static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return __cxx_atomic_fetch_add(&this->__a_, __op, __m);
+ return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m);
}
_LIBCPP_INLINE_VISIBILITY
_Tp* fetch_sub(ptr
diff _t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
// __atomic_fetch_add accepts function pointers, guard against them.
static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);
+ return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m);
}
_LIBCPP_INLINE_VISIBILITY
_Tp* fetch_sub(ptr
diff _t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
// __atomic_fetch_add accepts function pointers, guard against them.
static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
- return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);
+ return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m);
}
_LIBCPP_INLINE_VISIBILITY
@@ -1838,7 +1838,7 @@ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY
void
atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
{
- __cxx_atomic_init(&__o->__a_, __d);
+ std::__cxx_atomic_init(&__o->__a_, __d);
}
template <class _Tp>
@@ -1846,7 +1846,7 @@ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY
void
atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
{
- __cxx_atomic_init(&__o->__a_, __d);
+ std::__cxx_atomic_init(&__o->__a_, __d);
}
// atomic_store
diff --git a/libcxx/include/barrier b/libcxx/include/barrier
index a2f753677b55b..2e8906b71379c 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -125,7 +125,7 @@ public:
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
__barrier_base(ptr
diff _t __expected, _CompletionF __completion = _CompletionF())
- : __expected_(__expected), __base_(__construct_barrier_algorithm_base(this->__expected_),
+ : __expected_(__expected), __base_(std::__construct_barrier_algorithm_base(this->__expected_),
&__destroy_barrier_algorithm_base),
__expected_adjustment_(0), __completion_(std::move(__completion)), __phase_(0)
{
@@ -150,7 +150,7 @@ public:
auto const __test_fn = [this, __old_phase]() -> bool {
return __phase_.load(memory_order_acquire) != __old_phase;
};
- __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
+ std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
void arrive_and_drop()
diff --git a/libcxx/include/charconv b/libcxx/include/charconv
index 4063117b30ad4..8b06d828c9c25 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -231,7 +231,7 @@ template <typename _Tp, typename _Up>
inline _LIBCPP_HIDE_FROM_ABI bool
_LIBCPP_CONSTEXPR_SINCE_CXX23 __mul_overflowed(_Tp __a, _Up __b, _Tp& __r)
{
- return __mul_overflowed(__a, static_cast<_Tp>(__b), __r);
+ return __itoa::__mul_overflowed(__a, static_cast<_Tp>(__b), __r);
}
template <typename _Tp>
@@ -257,7 +257,7 @@ struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp>
__a = __inner_product(__cprod + __i + 1, __cprod + __j, __pow() + 1,
__cprod[__i]);
- if (__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b))
+ if (__itoa::__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b))
--__p;
return __p;
}
@@ -282,18 +282,22 @@ __complement(_Tp __x)
return _Tp(~__x + 1);
}
+template <typename _Tp>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
+__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type);
+
template <typename _Tp>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_itoa(char* __first, char* __last, _Tp __value, true_type)
{
- auto __x = __to_unsigned_like(__value);
+ auto __x = std::__to_unsigned_like(__value);
if (__value < 0 && __first != __last)
{
*__first++ = '-';
- __x = __complement(__x);
+ __x = std::__complement(__x);
}
- return __to_chars_itoa(__first, __last, __x, false_type());
+ return std::__to_chars_itoa(__first, __last, __x, false_type());
}
template <typename _Tp>
@@ -331,19 +335,23 @@ __to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type)
}
#endif
+template <class _Tp>
+inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
+__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type);
+
template <typename _Tp>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
true_type)
{
- auto __x = __to_unsigned_like(__value);
+ auto __x = std::__to_unsigned_like(__value);
if (__value < 0 && __first != __last)
{
*__first++ = '-';
- __x = __complement(__x);
+ __x = std::__complement(__x);
}
- return __to_chars_integral(__first, __last, __x, __base, false_type());
+ return std::__to_chars_integral(__first, __last, __x, __base, false_type());
}
namespace __itoa {
@@ -521,19 +529,19 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
false_type)
{
if (__base == 10) [[likely]]
- return __to_chars_itoa(__first, __last, __value, false_type());
+ return std::__to_chars_itoa(__first, __last, __value, false_type());
switch (__base) {
case 2:
- return __to_chars_integral<2>(__first, __last, __value);
+ return std::__to_chars_integral<2>(__first, __last, __value);
case 8:
- return __to_chars_integral<8>(__first, __last, __value);
+ return std::__to_chars_integral<8>(__first, __last, __value);
case 16:
- return __to_chars_integral<16>(__first, __last, __value);
+ return std::__to_chars_integral<16>(__first, __last, __value);
}
ptr
diff _t __cap = __last - __first;
- int __n = __to_chars_integral_width(__value, __base);
+ int __n = std::__to_chars_integral_width(__value, __base);
if (__n > __cap)
return {__last, errc::value_too_large};
@@ -571,7 +579,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
__sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args)
{
using __tl = numeric_limits<_Tp>;
- decltype(__to_unsigned_like(__value)) __x;
+ decltype(std::__to_unsigned_like(__value)) __x;
bool __neg = (__first != __last && *__first == '-');
auto __r = __f(__neg ? __first + 1 : __first, __last, __x, __args...);
@@ -587,16 +595,16 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args)
if (__neg)
{
- if (__x <= __complement(__to_unsigned_like(__tl::min())))
+ if (__x <= std::__complement(std::__to_unsigned_like(__tl::min())))
{
- __x = __complement(__x);
+ __x = std::__complement(__x);
std::copy_n(std::addressof(__x), 1, std::addressof(__value));
return __r;
}
}
else
{
- if (__x <= __to_unsigned_like(__tl::max()))
+ if (__x <= std::__to_unsigned_like(__tl::max()))
{
__value = __x;
return __r;
@@ -627,7 +635,7 @@ __in_pattern(_Tp __c, int __base)
{
if (__base <= 10)
return {'0' <= __c && __c < '0' + __base, __c - '0'};
- else if (__in_pattern(__c))
+ else if (std::__in_pattern(__c))
return {true, __c - '0'};
else if ('a' <= __c && __c < 'a' + __base - 10)
return {true, __c - 'a' + 10};
@@ -648,7 +656,7 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f,
};
auto __p = __find_non_zero(__first, __last);
- if (__p == __last || !__in_pattern(*__p, __args...))
+ if (__p == __last || !std::__in_pattern(*__p, __args...))
{
if (__p == __first)
return {__first, errc::invalid_argument};
@@ -664,7 +672,7 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f,
{
for (; __r.ptr != __last; ++__r.ptr)
{
- if (!__in_pattern(*__r.ptr, __args...))
+ if (!std::__in_pattern(*__r.ptr, __args...))
break;
}
}
@@ -679,13 +687,13 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
using __tx = __itoa::__traits<_Tp>;
using __output_type = typename __tx::type;
- return __subject_seq_combinator(
+ return std::__subject_seq_combinator(
__first, __last, __value,
[](const char* __f, const char* __l,
_Tp& __val) -> from_chars_result {
__output_type __a, __b;
auto __p = __tx::__read(__f, __l, __a, __b);
- if (__p == __l || !__in_pattern(*__p))
+ if (__p == __l || !std::__in_pattern(*__p))
{
__output_type __m = numeric_limits<_Tp>::max();
if (__m >= __a && __m - __a >= __b)
@@ -702,8 +710,8 @@ template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
__from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
{
- using __t = decltype(__to_unsigned_like(__value));
- return __sign_combinator(__first, __last, __value, __from_chars_atoi<__t>);
+ using __t = decltype(std::__to_unsigned_like(__value));
+ return std::__sign_combinator(__first, __last, __value, __from_chars_atoi<__t>);
}
@@ -731,9 +739,9 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
int __base)
{
if (__base == 10)
- return __from_chars_atoi(__first, __last, __value);
+ return std::__from_chars_atoi(__first, __last, __value);
- return __subject_seq_combinator(
+ return std::__subject_seq_combinator(
__first, __last, __value,
[](const char* __p, const char* __lastp, _Tp& __val,
int __b) -> from_chars_result {
@@ -778,16 +786,16 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
__from_chars_integral(const char* __first, const char* __last, _Tp& __value,
int __base)
{
- using __t = decltype(__to_unsigned_like(__value));
- return __sign_combinator(__first, __last, __value,
- __from_chars_integral<__t>, __base);
+ using __t = decltype(std::__to_unsigned_like(__value));
+ return std::__sign_combinator(__first, __last, __value,
+ __from_chars_integral<__t>, __base);
}
template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
from_chars(const char* __first, const char* __last, _Tp& __value)
{
- return __from_chars_atoi(__first, __last, __value);
+ return std::__from_chars_atoi(__first, __last, __value);
}
template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
@@ -795,7 +803,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
from_chars(const char* __first, const char* __last, _Tp& __value, int __base)
{
_LIBCPP_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]");
- return __from_chars_integral(__first, __last, __value, __base);
+ return std::__from_chars_integral(__first, __last, __value, __base);
}
_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS
diff --git a/libcxx/include/cmath b/libcxx/include/cmath
index fd242e12f0638..29eb0fee57ee4 100644
--- a/libcxx/include/cmath
+++ b/libcxx/include/cmath
@@ -562,7 +562,7 @@ hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
static_assert((!(is_same<_A1, __result_type>::value &&
is_same<_A2, __result_type>::value &&
is_same<_A3, __result_type>::value)), "");
- return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
+ return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
}
#endif
@@ -583,7 +583,7 @@ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
__constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT
{
- return isnan(__lcpp_x);
+ return std::isnan(__lcpp_x);
}
template <class _A1>
@@ -603,7 +603,7 @@ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
__constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT
{
- return isinf(__lcpp_x);
+ return std::isinf(__lcpp_x);
}
template <class _A1>
@@ -623,7 +623,7 @@ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
__constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT
{
- return isfinite(__lcpp_x);
+ return std::isfinite(__lcpp_x);
}
#if _LIBCPP_STD_VER > 17
@@ -665,7 +665,7 @@ lerp(_A1 __a, _A2 __b, _A3 __t) noexcept
static_assert(!(_IsSame<_A1, __result_type>::value &&
_IsSame<_A2, __result_type>::value &&
_IsSame<_A3, __result_type>::value));
- return __lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
+ return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
}
#endif // _LIBCPP_STD_VER > 17
diff --git a/libcxx/include/complex b/libcxx/include/complex
index 2c1c5a2114a8a..1117dda257a34 100644
--- a/libcxx/include/complex
+++ b/libcxx/include/complex
@@ -596,40 +596,40 @@ operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
_Tp __bc = __b * __c;
_Tp __x = __ac - __bd;
_Tp __y = __ad + __bc;
- if (__constexpr_isnan(__x) && __constexpr_isnan(__y))
+ if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y))
{
bool __recalc = false;
- if (__constexpr_isinf(__a) || __constexpr_isinf(__b))
+ if (std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b))
{
- __a = copysign(__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
- __b = copysign(__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
- if (__constexpr_isnan(__c))
- __c = copysign(_Tp(0), __c);
- if (__constexpr_isnan(__d))
- __d = copysign(_Tp(0), __d);
+ __a = std::copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
+ __b = std::copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
+ if (std::__constexpr_isnan(__c))
+ __c = std::copysign(_Tp(0), __c);
+ if (std::__constexpr_isnan(__d))
+ __d = std::copysign(_Tp(0), __d);
__recalc = true;
}
- if (__constexpr_isinf(__c) || __constexpr_isinf(__d))
+ if (std::__constexpr_isinf(__c) || std::__constexpr_isinf(__d))
{
- __c = copysign(__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
- __d = copysign(__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
- if (__constexpr_isnan(__a))
- __a = copysign(_Tp(0), __a);
- if (__constexpr_isnan(__b))
- __b = copysign(_Tp(0), __b);
+ __c = std::copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
+ __d = std::copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
+ if (std::__constexpr_isnan(__a))
+ __a = std::copysign(_Tp(0), __a);
+ if (std::__constexpr_isnan(__b))
+ __b = std::copysign(_Tp(0), __b);
__recalc = true;
}
- if (!__recalc && (__constexpr_isinf(__ac) || __constexpr_isinf(__bd) ||
- __constexpr_isinf(__ad) || __constexpr_isinf(__bc)))
+ if (!__recalc && (std::__constexpr_isinf(__ac) || std::__constexpr_isinf(__bd) ||
+ std::__constexpr_isinf(__ad) || std::__constexpr_isinf(__bc)))
{
- if (__constexpr_isnan(__a))
- __a = copysign(_Tp(0), __a);
- if (__constexpr_isnan(__b))
- __b = copysign(_Tp(0), __b);
- if (__constexpr_isnan(__c))
- __c = copysign(_Tp(0), __c);
- if (__constexpr_isnan(__d))
- __d = copysign(_Tp(0), __d);
+ if (std::__constexpr_isnan(__a))
+ __a = std::copysign(_Tp(0), __a);
+ if (std::__constexpr_isnan(__b))
+ __b = std::copysign(_Tp(0), __b);
+ if (std::__constexpr_isnan(__c))
+ __c = std::copysign(_Tp(0), __c);
+ if (std::__constexpr_isnan(__d))
+ __d = std::copysign(_Tp(0), __d);
__recalc = true;
}
if (__recalc)
@@ -670,34 +670,34 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
_Tp __b = __z.imag();
_Tp __c = __w.real();
_Tp __d = __w.imag();
- _Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
- if (__constexpr_isfinite(__logbw))
+ _Tp __logbw = std::logb(std::fmax(std::fabs(__c), std::fabs(__d)));
+ if (std::__constexpr_isfinite(__logbw))
{
__ilogbw = static_cast<int>(__logbw);
- __c = scalbn(__c, -__ilogbw);
- __d = scalbn(__d, -__ilogbw);
+ __c = std::scalbn(__c, -__ilogbw);
+ __d = std::scalbn(__d, -__ilogbw);
}
_Tp __denom = __c * __c + __d * __d;
- _Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
- _Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
- if (__constexpr_isnan(__x) && __constexpr_isnan(__y))
+ _Tp __x = std::scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
+ _Tp __y = std::scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
+ if (std::__constexpr_isnan(__x) && std::__constexpr_isnan(__y))
{
- if ((__denom == _Tp(0)) && (!__constexpr_isnan(__a) || !__constexpr_isnan(__b)))
+ if ((__denom == _Tp(0)) && (!std::__constexpr_isnan(__a) || !std::__constexpr_isnan(__b)))
{
- __x = copysign(_Tp(INFINITY), __c) * __a;
- __y = copysign(_Tp(INFINITY), __c) * __b;
+ __x = std::copysign(_Tp(INFINITY), __c) * __a;
+ __y = std::copysign(_Tp(INFINITY), __c) * __b;
}
- else if ((__constexpr_isinf(__a) || __constexpr_isinf(__b)) && __constexpr_isfinite(__c) && __constexpr_isfinite(__d))
+ else if ((std::__constexpr_isinf(__a) || std::__constexpr_isinf(__b)) && std::__constexpr_isfinite(__c) && std::__constexpr_isfinite(__d))
{
- __a = copysign(__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
- __b = copysign(__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
+ __a = std::copysign(std::__constexpr_isinf(__a) ? _Tp(1) : _Tp(0), __a);
+ __b = std::copysign(std::__constexpr_isinf(__b) ? _Tp(1) : _Tp(0), __b);
__x = _Tp(INFINITY) * (__a * __c + __b * __d);
__y = _Tp(INFINITY) * (__b * __c - __a * __d);
}
- else if (__constexpr_isinf(__logbw) && __logbw > _Tp(0) && __constexpr_isfinite(__a) && __constexpr_isfinite(__b))
+ else if (std::__constexpr_isinf(__logbw) && __logbw > _Tp(0) && std::__constexpr_isfinite(__a) && std::__constexpr_isfinite(__b))
{
- __c = copysign(__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
- __d = copysign(__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
+ __c = std::copysign(std::__constexpr_isinf(__c) ? _Tp(1) : _Tp(0), __c);
+ __d = std::copysign(std::__constexpr_isinf(__d) ? _Tp(1) : _Tp(0), __d);
__x = _Tp(0) * (__a * __c + __b * __d);
__y = _Tp(0) * (__b * __c - __a * __d);
}
@@ -853,7 +853,7 @@ inline _LIBCPP_INLINE_VISIBILITY
_Tp
abs(const complex<_Tp>& __c)
{
- return hypot(__c.real(), __c.imag());
+ return std::hypot(__c.real(), __c.imag());
}
// arg
@@ -863,7 +863,7 @@ inline _LIBCPP_INLINE_VISIBILITY
_Tp
arg(const complex<_Tp>& __c)
{
- return atan2(__c.imag(), __c.real());
+ return std::atan2(__c.imag(), __c.real());
}
template <class _Tp>
@@ -874,7 +874,7 @@ typename enable_if<
>::type
arg(_Tp __re)
{
- return atan2l(0.L, __re);
+ return std::atan2l(0.L, __re);
}
template<class _Tp>
@@ -886,7 +886,7 @@ typename enable_if
>::type
arg(_Tp __re)
{
- return atan2(0., __re);
+ return std::atan2(0., __re);
}
template <class _Tp>
@@ -897,7 +897,7 @@ typename enable_if<
>::type
arg(_Tp __re)
{
- return atan2f(0.F, __re);
+ return std::atan2f(0.F, __re);
}
// norm
@@ -907,10 +907,10 @@ inline _LIBCPP_INLINE_VISIBILITY
_Tp
norm(const complex<_Tp>& __c)
{
- if (__constexpr_isinf(__c.real()))
- return abs(__c.real());
- if (__constexpr_isinf(__c.imag()))
- return abs(__c.imag());
+ if (std::__constexpr_isinf(__c.real()))
+ return std::abs(__c.real());
+ if (std::__constexpr_isinf(__c.imag()))
+ return std::abs(__c.imag());
return __c.real() * __c.real() + __c.imag() * __c.imag();
}
@@ -952,8 +952,8 @@ complex<_Tp>
proj(const complex<_Tp>& __c)
{
complex<_Tp> __r = __c;
- if (__constexpr_isinf(__c.real()) || __constexpr_isinf(__c.imag()))
- __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
+ if (std::__constexpr_isinf(__c.real()) || std::__constexpr_isinf(__c.imag()))
+ __r = complex<_Tp>(INFINITY, std::copysign(_Tp(0), __c.imag()));
return __r;
}
@@ -966,8 +966,8 @@ typename enable_if
>::type
proj(_Tp __re)
{
- if (__constexpr_isinf(__re))
- __re = abs(__re);
+ if (std::__constexpr_isinf(__re))
+ __re = std::abs(__re);
return complex<_Tp>(__re);
}
@@ -990,25 +990,25 @@ template<class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp>
polar(const _Tp& __rho, const _Tp& __theta = _Tp())
{
- if (__constexpr_isnan(__rho) || signbit(__rho))
+ if (std::__constexpr_isnan(__rho) || std::signbit(__rho))
return complex<_Tp>(_Tp(NAN), _Tp(NAN));
- if (__constexpr_isnan(__theta))
+ if (std::__constexpr_isnan(__theta))
{
- if (__constexpr_isinf(__rho))
+ if (std::__constexpr_isinf(__rho))
return complex<_Tp>(__rho, __theta);
return complex<_Tp>(__theta, __theta);
}
- if (__constexpr_isinf(__theta))
+ if (std::__constexpr_isinf(__theta))
{
- if (__constexpr_isinf(__rho))
+ if (std::__constexpr_isinf(__rho))
return complex<_Tp>(__rho, _Tp(NAN));
return complex<_Tp>(_Tp(NAN), _Tp(NAN));
}
- _Tp __x = __rho * cos(__theta);
- if (__constexpr_isnan(__x))
+ _Tp __x = __rho * std::cos(__theta);
+ if (std::__constexpr_isnan(__x))
__x = 0;
- _Tp __y = __rho * sin(__theta);
- if (__constexpr_isnan(__y))
+ _Tp __y = __rho * std::sin(__theta);
+ if (std::__constexpr_isnan(__y))
__y = 0;
return complex<_Tp>(__x, __y);
}
@@ -1020,7 +1020,7 @@ inline _LIBCPP_INLINE_VISIBILITY
complex<_Tp>
log(const complex<_Tp>& __x)
{
- return complex<_Tp>(log(abs(__x)), arg(__x));
+ return complex<_Tp>(std::log(std::abs(__x)), std::arg(__x));
}
// log10
@@ -1030,7 +1030,7 @@ inline _LIBCPP_INLINE_VISIBILITY
complex<_Tp>
log10(const complex<_Tp>& __x)
{
- return log(__x) / log(_Tp(10));
+ return std::log(__x) / std::log(_Tp(10));
}
// sqrt
@@ -1039,15 +1039,15 @@ template<class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp>
sqrt(const complex<_Tp>& __x)
{
- if (__constexpr_isinf(__x.imag()))
+ if (std::__constexpr_isinf(__x.imag()))
return complex<_Tp>(_Tp(INFINITY), __x.imag());
- if (__constexpr_isinf(__x.real()))
+ if (std::__constexpr_isinf(__x.real()))
{
if (__x.real() > _Tp(0))
- return complex<_Tp>(__x.real(), __constexpr_isnan(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
- return complex<_Tp>(__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
+ return complex<_Tp>(__x.real(), std::__constexpr_isnan(__x.imag()) ? __x.imag() : std::copysign(_Tp(0), __x.imag()));
+ return complex<_Tp>(std::__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), std::copysign(__x.real(), __x.imag()));
}
- return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
+ return std::polar(std::sqrt(std::abs(__x)), std::arg(__x) / _Tp(2));
}
// exp
@@ -1058,24 +1058,24 @@ exp(const complex<_Tp>& __x)
{
_Tp __i = __x.imag();
if (__i == 0) {
- return complex<_Tp>(exp(__x.real()), copysign(_Tp(0), __x.imag()));
+ return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag()));
}
- if (__constexpr_isinf(__x.real()))
+ if (std::__constexpr_isinf(__x.real()))
{
if (__x.real() < _Tp(0))
{
- if (!__constexpr_isfinite(__i))
+ if (!std::__constexpr_isfinite(__i))
__i = _Tp(1);
}
- else if (__i == 0 || !__constexpr_isfinite(__i))
+ else if (__i == 0 || !std::__constexpr_isfinite(__i))
{
- if (__constexpr_isinf(__i))
+ if (std::__constexpr_isinf(__i))
__i = _Tp(NAN);
return complex<_Tp>(__x.real(), __i);
}
}
- _Tp __e = exp(__x.real());
- return complex<_Tp>(__e * cos(__i), __e * sin(__i));
+ _Tp __e = std::exp(__x.real());
+ return complex<_Tp>(__e * std::cos(__i), __e * std::sin(__i));
}
// pow
@@ -1085,7 +1085,7 @@ inline _LIBCPP_INLINE_VISIBILITY
complex<_Tp>
pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
- return exp(__y * log(__x));
+ return std::exp(__y * std::log(__x));
}
template<class _Tp, class _Up>
@@ -1141,26 +1141,26 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp>
asinh(const complex<_Tp>& __x)
{
const _Tp __pi(atan2(+0., -0.));
- if (__constexpr_isinf(__x.real()))
+ if (std::__constexpr_isinf(__x.real()))
{
- if (__constexpr_isnan(__x.imag()))
+ if (std::__constexpr_isnan(__x.imag()))
return __x;
- if (__constexpr_isinf(__x.imag()))
- return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
- return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
+ return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
}
- if (__constexpr_isnan(__x.real()))
+ if (std::__constexpr_isnan(__x.real()))
{
- if (__constexpr_isinf(__x.imag()))
+ if (std::__constexpr_isinf(__x.imag()))
return complex<_Tp>(__x.imag(), __x.real());
if (__x.imag() == 0)
return __x;
return complex<_Tp>(__x.real(), __x.real());
}
- if (__constexpr_isinf(__x.imag()))
- return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
- complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1)));
- return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(std::copysign(__x.imag(), __x.real()), std::copysign(__pi/_Tp(2), __x.imag()));
+ complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) + _Tp(1)));
+ return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
}
// acosh
@@ -1170,31 +1170,31 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp>
acosh(const complex<_Tp>& __x)
{
const _Tp __pi(atan2(+0., -0.));
- if (__constexpr_isinf(__x.real()))
+ if (std::__constexpr_isinf(__x.real()))
{
- if (__constexpr_isnan(__x.imag()))
- return complex<_Tp>(abs(__x.real()), __x.imag());
- if (__constexpr_isinf(__x.imag()))
+ if (std::__constexpr_isnan(__x.imag()))
+ return complex<_Tp>(std::abs(__x.real()), __x.imag());
+ if (std::__constexpr_isinf(__x.imag()))
{
if (__x.real() > 0)
- return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
+ return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag()));
else
- return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
+ return complex<_Tp>(-__x.real(), std::copysign(__pi * _Tp(0.75), __x.imag()));
}
if (__x.real() < 0)
- return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
- return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
+ return complex<_Tp>(-__x.real(), std::copysign(__pi, __x.imag()));
+ return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag()));
}
- if (__constexpr_isnan(__x.real()))
+ if (std::__constexpr_isnan(__x.real()))
{
- if (__constexpr_isinf(__x.imag()))
- return complex<_Tp>(abs(__x.imag()), __x.real());
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(std::abs(__x.imag()), __x.real());
return complex<_Tp>(__x.real(), __x.real());
}
- if (__constexpr_isinf(__x.imag()))
- return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag()));
- complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
- return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag()));
+ if (std::__constexpr_isinf(__x.imag()))
+ return complex<_Tp>(std::abs(__x.imag()), std::copysign(__pi/_Tp(2), __x.imag()));
+ complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
+ return complex<_Tp>(std::copysign(__z.real(), _Tp(0)), std::copysign(__z.imag(), __x.imag()));
}
// atanh
@@ -1204,30 +1204,30 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp>
atanh(const complex<_Tp>& __x)
{
const _Tp __pi(atan2(+0., -0.));
- if (__constexpr_isinf(__x.imag()))
+ if (std::__constexpr_isinf(__x.imag()))
{
- return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
+ return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi/_Tp(2), __x.imag()));
}
- if (__constexpr_isnan(__x.imag()))
+ if (std::__constexpr_isnan(__x.imag()))
{
- if (__constexpr_isinf(__x.real()) || __x.real() == 0)
- return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
+ if (std::__constexpr_isinf(__x.real()) || __x.real() == 0)
+ return complex<_Tp>(std::copysign(_Tp(0), __x.real()), __x.imag());
return complex<_Tp>(__x.imag(), __x.imag());
}
- if (__constexpr_isnan(__x.real()))
+ if (std::__constexpr_isnan(__x.real()))
{
return complex<_Tp>(__x.real(), __x.real());
}
- if (__constexpr_isinf(__x.real()))
+ if (std::__constexpr_isinf(__x.real()))
{
- return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
+ return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi/_Tp(2), __x.imag()));
}
- if (abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0))
+ if (std::abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0))
{
- return complex<_Tp>(copysign(_Tp(INFINITY), __x.real()), copysign(_Tp(0), __x.imag()));
+ return complex<_Tp>(std::copysign(_Tp(INFINITY), __x.real()), std::copysign(_Tp(0), __x.imag()));
}
- complex<_Tp> __z = log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
- return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
+ complex<_Tp> __z = std::log((_Tp(1) + __x) / (_Tp(1) - __x)) / _Tp(2);
+ return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag()));
}
// sinh
@@ -1236,13 +1236,13 @@ template<class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp>
sinh(const complex<_Tp>& __x)
{
- if (__constexpr_isinf(__x.real()) && !__constexpr_isfinite(__x.imag()))
+ if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.real() == 0 && !__constexpr_isfinite(__x.imag()))
+ if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.imag() == 0 && !__constexpr_isfinite(__x.real()))
+ if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
return __x;
- return complex<_Tp>(sinh(__x.real()) * cos(__x.imag()), cosh(__x.real()) * sin(__x.imag()));
+ return complex<_Tp>(std::sinh(__x.real()) * std::cos(__x.imag()), std::cosh(__x.real()) * std::sin(__x.imag()));
}
// cosh
@@ -1251,15 +1251,15 @@ template<class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp>
cosh(const complex<_Tp>& __x)
{
- if (__constexpr_isinf(__x.real()) && !__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(abs(__x.real()), _Tp(NAN));
- if (__x.real() == 0 && !__constexpr_isfinite(__x.imag()))
+ if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(std::abs(__x.real()), _Tp(NAN));
+ if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag()))
return complex<_Tp>(_Tp(NAN), __x.real());
if (__x.real() == 0 && __x.imag() == 0)
return complex<_Tp>(_Tp(1), __x.imag());
- if (__x.imag() == 0 && !__constexpr_isfinite(__x.real()))
- return complex<_Tp>(abs(__x.real()), __x.imag());
- return complex<_Tp>(cosh(__x.real()) * cos(__x.imag()), sinh(__x.real()) * sin(__x.imag()));
+ if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real()))
+ return complex<_Tp>(std::abs(__x.real()), __x.imag());
+ return complex<_Tp>(std::cosh(__x.real()) * std::cos(__x.imag()), std::sinh(__x.real()) * std::sin(__x.imag()));
}
// tanh
@@ -1268,22 +1268,22 @@ template<class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp>
tanh(const complex<_Tp>& __x)
{
- if (__constexpr_isinf(__x.real()))
+ if (std::__constexpr_isinf(__x.real()))
{
- if (!__constexpr_isfinite(__x.imag()))
- return complex<_Tp>(copysign(_Tp(1), __x.real()), _Tp(0));
- return complex<_Tp>(copysign(_Tp(1), __x.real()), copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
+ if (!std::__constexpr_isfinite(__x.imag()))
+ return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0));
+ return complex<_Tp>(std::copysign(_Tp(1), __x.real()), std::copysign(_Tp(0), std::sin(_Tp(2) * __x.imag())));
}
- if (__constexpr_isnan(__x.real()) && __x.imag() == 0)
+ if (std::__constexpr_isnan(__x.real()) && __x.imag() == 0)
return __x;
_Tp __2r(_Tp(2) * __x.real());
_Tp __2i(_Tp(2) * __x.imag());
- _Tp __d(cosh(__2r) + cos(__2i));
- _Tp __2rsh(sinh(__2r));
- if (__constexpr_isinf(__2rsh) && __constexpr_isinf(__d))
+ _Tp __d(std::cosh(__2r) + std::cos(__2i));
+ _Tp __2rsh(std::sinh(__2r));
+ if (std::__constexpr_isinf(__2rsh) && std::__constexpr_isinf(__d))
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
- return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
+ return complex<_Tp>(__2rsh/__d, std::sin(__2i)/__d);
}
// asin
@@ -1292,7 +1292,7 @@ template<class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp>
asin(const complex<_Tp>& __x)
{
- complex<_Tp> __z = asinh(complex<_Tp>(-__x.imag(), __x.real()));
+ complex<_Tp> __z = std::asinh(complex<_Tp>(-__x.imag(), __x.real()));
return complex<_Tp>(__z.imag(), -__z.real());
}
@@ -1303,34 +1303,34 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp>
acos(const complex<_Tp>& __x)
{
const _Tp __pi(atan2(+0., -0.));
- if (__constexpr_isinf(__x.real()))
+ if (std::__constexpr_isinf(__x.real()))
{
- if (__constexpr_isnan(__x.imag()))
+ if (std::__constexpr_isnan(__x.imag()))
return complex<_Tp>(__x.imag(), __x.real());
- if (__constexpr_isinf(__x.imag()))
+ if (std::__constexpr_isinf(__x.imag()))
{
if (__x.real() < _Tp(0))
return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag());
}
if (__x.real() < _Tp(0))
- return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real());
- return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real());
+ return complex<_Tp>(__pi, std::signbit(__x.imag()) ? -__x.real() : __x.real());
+ return complex<_Tp>(_Tp(0), std::signbit(__x.imag()) ? __x.real() : -__x.real());
}
- if (__constexpr_isnan(__x.real()))
+ if (std::__constexpr_isnan(__x.real()))
{
- if (__constexpr_isinf(__x.imag()))
+ if (std::__constexpr_isinf(__x.imag()))
return complex<_Tp>(__x.real(), -__x.imag());
return complex<_Tp>(__x.real(), __x.real());
}
- if (__constexpr_isinf(__x.imag()))
+ if (std::__constexpr_isinf(__x.imag()))
return complex<_Tp>(__pi/_Tp(2), -__x.imag());
- if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag())))
+ if (__x.real() == 0 && (__x.imag() == 0 || std::isnan(__x.imag())))
return complex<_Tp>(__pi/_Tp(2), -__x.imag());
- complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
- if (signbit(__x.imag()))
- return complex<_Tp>(abs(__z.imag()), abs(__z.real()));
- return complex<_Tp>(abs(__z.imag()), -abs(__z.real()));
+ complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1)));
+ if (std::signbit(__x.imag()))
+ return complex<_Tp>(std::abs(__z.imag()), std::abs(__z.real()));
+ return complex<_Tp>(std::abs(__z.imag()), -std::abs(__z.real()));
}
// atan
@@ -1339,7 +1339,7 @@ template<class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp>
atan(const complex<_Tp>& __x)
{
- complex<_Tp> __z = atanh(complex<_Tp>(-__x.imag(), __x.real()));
+ complex<_Tp> __z = std::atanh(complex<_Tp>(-__x.imag(), __x.real()));
return complex<_Tp>(__z.imag(), -__z.real());
}
@@ -1349,7 +1349,7 @@ template<class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp>
sin(const complex<_Tp>& __x)
{
- complex<_Tp> __z = sinh(complex<_Tp>(-__x.imag(), __x.real()));
+ complex<_Tp> __z = std::sinh(complex<_Tp>(-__x.imag(), __x.real()));
return complex<_Tp>(__z.imag(), -__z.real());
}
@@ -1360,7 +1360,7 @@ inline _LIBCPP_INLINE_VISIBILITY
complex<_Tp>
cos(const complex<_Tp>& __x)
{
- return cosh(complex<_Tp>(-__x.imag(), __x.real()));
+ return std::cosh(complex<_Tp>(-__x.imag(), __x.real()));
}
// tan
@@ -1369,17 +1369,18 @@ template<class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp>
tan(const complex<_Tp>& __x)
{
- complex<_Tp> __z = tanh(complex<_Tp>(-__x.imag(), __x.real()));
+ complex<_Tp> __z = std::tanh(complex<_Tp>(-__x.imag(), __x.real()));
return complex<_Tp>(__z.imag(), -__z.real());
}
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
template<class _Tp, class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
{
if (__is.good())
{
- ws(__is);
+ std::ws(__is);
if (__is.peek() == _CharT('('))
{
__is.get();
@@ -1387,7 +1388,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
__is >> __r;
if (!__is.fail())
{
- ws(__is);
+ std::ws(__is);
_CharT __c = __is.peek();
if (__c == _CharT(','))
{
@@ -1396,7 +1397,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
__is >> __i;
if (!__is.fail())
{
- ws(__is);
+ std::ws(__is);
__c = __is.peek();
if (__c == _CharT(')'))
{
@@ -1435,7 +1436,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
return __is;
}
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
template<class _Tp, class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
diff --git a/libcxx/include/deque b/libcxx/include/deque
index 989b64d7a109e..8445883397451 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -2315,7 +2315,7 @@ deque<_Tp, _Allocator>::__add_front_capacity()
else
{
__split_buffer<pointer, __pointer_allocator&>
- __buf(max<size_type>(2 * __map_.capacity(), 1),
+ __buf(std::max<size_type>(2 * __map_.capacity(), 1),
0, __map_.__alloc());
typedef __allocator_destructor<_Allocator> _Dp;
@@ -2388,8 +2388,8 @@ deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
{
size_type __ds = (__nb + __back_capacity) * __block_size - __map_.empty();
__split_buffer<pointer, __pointer_allocator&>
- __buf(max<size_type>(2* __map_.capacity(),
- __nb + __map_.size()),
+ __buf(std::max<size_type>(2* __map_.capacity(),
+ __nb + __map_.size()),
0, __map_.__alloc());
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -2457,7 +2457,7 @@ deque<_Tp, _Allocator>::__add_back_capacity()
else
{
__split_buffer<pointer, __pointer_allocator&>
- __buf(max<size_type>(2* __map_.capacity(), 1),
+ __buf(std::max<size_type>(2* __map_.capacity(), 1),
__map_.size(),
__map_.__alloc());
@@ -2529,8 +2529,8 @@ deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
{
size_type __ds = __front_capacity * __block_size;
__split_buffer<pointer, __pointer_allocator&>
- __buf(max<size_type>(2* __map_.capacity(),
- __nb + __map_.size()),
+ __buf(std::max<size_type>(2* __map_.capacity(),
+ __nb + __map_.size()),
__map_.size() - __front_capacity,
__map_.__alloc());
#ifndef _LIBCPP_NO_EXCEPTIONS
diff --git a/libcxx/include/experimental/functional b/libcxx/include/experimental/functional
index 39281bd5771d3..cb9a5efac3f86 100644
--- a/libcxx/include/experimental/functional
+++ b/libcxx/include/experimental/functional
@@ -205,8 +205,8 @@ public:
_Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
: __first_(__f), __last_(__l), __pred_(__pred),
__pattern_length_(_VSTD::distance(__first_, __last_)),
- __skip_{make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)},
- __suffix_{make_shared<vector<
diff erence_type>>(__pattern_length_ + 1)}
+ __skip_{std::make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)},
+ __suffix_{std::make_shared<vector<
diff erence_type>>(__pattern_length_ + 1)}
{
// build the skip table
for (
diff erence_type __i = 0; __f != __l; ++__f, (void) ++__i )
@@ -223,12 +223,12 @@ public:
typename iterator_traits<_RandomAccessIterator2>::value_type>::value,
"Corpus and Pattern iterators must point to the same type");
- if (__f == __l ) return make_pair(__l, __l); // empty corpus
- if (__first_ == __last_) return make_pair(__f, __f); // empty pattern
+ if (__f == __l ) return std::make_pair(__l, __l); // empty corpus
+ if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern
// If the pattern is larger than the corpus, we can't find it!
if ( __pattern_length_ > _VSTD::distance(__f, __l))
- return make_pair(__l, __l);
+ return std::make_pair(__l, __l);
// Do the search
return this->__search(__f, __l);
@@ -260,7 +260,7 @@ private:
__j--;
// We matched - we're done!
if ( __j == 0 )
- return make_pair(__cur, __cur + __pattern_length_);
+ return std::make_pair(__cur, __cur + __pattern_length_);
}
// Since we didn't match, figure out how far to skip forward
@@ -272,7 +272,7 @@ private:
__cur += __suffix[ __j ];
}
- return make_pair(__l, __l); // We didn't find anything
+ return std::make_pair(__l, __l); // We didn't find anything
}
@@ -373,12 +373,12 @@ public:
typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value,
"Corpus and Pattern iterators must point to the same type");
- if (__f == __l ) return make_pair(__l, __l); // empty corpus
- if (__first_ == __last_) return make_pair(__f, __f); // empty pattern
+ if (__f == __l ) return std::make_pair(__l, __l); // empty corpus
+ if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern
// If the pattern is larger than the corpus, we can't find it!
if ( __pattern_length_ > _VSTD::distance(__f, __l))
- return make_pair(__l, __l);
+ return std::make_pair(__l, __l);
// Do the search
return this->__search(__f, __l);
@@ -407,12 +407,12 @@ private:
__j--;
// We matched - we're done!
if ( __j == 0 )
- return make_pair(__cur, __cur + __pattern_length_);
+ return std::make_pair(__cur, __cur + __pattern_length_);
}
__cur += __skip[__cur[__pattern_length_-1]];
}
- return make_pair(__l, __l);
+ return std::make_pair(__l, __l);
}
};
diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd
index 34afb5f1905b2..4ca67d212b237 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -925,7 +925,7 @@ constexpr typename std::enable_if<std::is_arithmetic<_To>::value &&
std::is_arithmetic<_From>::value,
bool>::type
__is_non_narrowing_arithmetic_convertible() {
- return __is_non_narrowing_convertible_impl<_To>(_From{});
+ return experimental::__is_non_narrowing_convertible_impl<_To>(_From{});
}
template <class _From, class _To>
@@ -944,7 +944,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __variadic_sum() {
template <class _Tp, class _Up, class... _Args>
_LIBCPP_HIDE_FROM_ABI constexpr _Tp __variadic_sum(_Up __first, _Args... __rest) {
- return static_cast<_Tp>(__first) + __variadic_sum<_Tp>(__rest...);
+ return static_cast<_Tp>(__first) + experimental::__variadic_sum<_Tp>(__rest...);
}
template <class _Tp>
@@ -1170,12 +1170,12 @@ array<_SimdType, simd_size<typename _SimdType::value_type, _Abi>::value /
split(const simd_mask<typename _SimdType::value_type, _Abi>&);
template <class _Tp, class... _Abis>
-simd<_Tp, abi_for_size_t<_Tp, __variadic_sum(simd_size<_Tp, _Abis>::value...)>>
+simd<_Tp, abi_for_size_t<_Tp, experimental::__variadic_sum(simd_size<_Tp, _Abis>::value...)>>
concat(const simd<_Tp, _Abis>&...);
template <class _Tp, class... _Abis>
simd_mask<_Tp,
- abi_for_size_t<_Tp, __variadic_sum(simd_size<_Tp, _Abis>::value...)>>
+ abi_for_size_t<_Tp, experimental::__variadic_sum(simd_size<_Tp, _Abis>::value...)>>
concat(const simd_mask<_Tp, _Abis>&...);
// reductions [simd.mask.reductions]
@@ -1379,7 +1379,7 @@ private:
std::integral_constant<size_t, __indicies>())...),
bool())
__can_generate(std::index_sequence<__indicies...>) {
- return !__variadic_sum<bool>(
+ return !experimental::__variadic_sum<bool>(
!__can_broadcast<decltype(std::declval<_Generator>()(
std::integral_constant<size_t, __indicies>()))>()...);
}
diff --git a/libcxx/include/fstream b/libcxx/include/fstream
index 62c6f53e9fe73..0c09f21913ec2 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -313,9 +313,9 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
__owns_ib_(false),
__always_noconv_(false)
{
- if (has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
+ if (std::has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
{
- __cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
+ __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(this->getloc());
__always_noconv_ = __cv_->always_noconv();
}
setbuf(nullptr, 4096);
@@ -734,7 +734,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
char_type __1buf;
if (this->gptr() == nullptr)
this->setg(&__1buf, &__1buf+1, &__1buf+1);
- const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4);
+ const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
int_type __c = traits_type::eof();
if (this->gptr() == this->egptr())
{
@@ -742,7 +742,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
if (__always_noconv_)
{
size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz);
- __nmemb = fread(this->eback() + __unget_sz, 1, __nmemb, __file_);
+ __nmemb = ::fread(this->eback() + __unget_sz, 1, __nmemb, __file_);
if (__nmemb != 0)
{
this->setg(this->eback(),
@@ -840,7 +840,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
if (__always_noconv_)
{
size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
- if (fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb)
+ if (std::fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb)
return traits_type::eof();
}
else
@@ -860,7 +860,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
if (__r == codecvt_base::noconv)
{
size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
- if (fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb)
+ if (std::fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb)
return traits_type::eof();
}
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
@@ -968,7 +968,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
return pos_type(off_type(-1));
pos_type __r = ftell(__file_);
#else
- if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
+ if (::fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
return pos_type(off_type(-1));
pos_type __r = ftello(__file_);
#endif
@@ -986,7 +986,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
if (fseek(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1));
#else
- if (fseeko(__file_, __sp, SEEK_SET))
+ if (::fseeko(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1));
#endif
__st_ = __sp.state();
@@ -1050,7 +1050,7 @@ basic_filebuf<_CharT, _Traits>::sync()
if (fseek(__file_, -__c, SEEK_CUR))
return -1;
#else
- if (fseeko(__file_, -__c, SEEK_CUR))
+ if (::fseeko(__file_, -__c, SEEK_CUR))
return -1;
#endif
if (__update_st)
@@ -1067,7 +1067,7 @@ void
basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
{
sync();
- __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
+ __cv_ = &std::use_facet<codecvt<char_type, char, state_type> >(__loc);
bool __old_anc = __always_noconv_;
__always_noconv_ = __cv_->always_noconv();
if (__old_anc != __always_noconv_)
diff --git a/libcxx/include/future b/libcxx/include/future
index a5c1a7bc5cfb1..a4747cdb33c21 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -685,7 +685,7 @@ __assoc_state<_Rp>::move()
unique_lock<mutex> __lk(this->__mut_);
this->__sub_wait(__lk);
if (this->__exception_ != nullptr)
- rethrow_exception(this->__exception_);
+ std::rethrow_exception(this->__exception_);
return _VSTD::move(*reinterpret_cast<_Rp*>(&__value_));
}
@@ -696,7 +696,7 @@ __assoc_state<_Rp>::copy()
unique_lock<mutex> __lk(this->__mut_);
this->__sub_wait(__lk);
if (this->__exception_ != nullptr)
- rethrow_exception(this->__exception_);
+ std::rethrow_exception(this->__exception_);
return *reinterpret_cast<_Rp*>(&__value_);
}
@@ -756,7 +756,7 @@ __assoc_state<_Rp&>::copy()
unique_lock<mutex> __lk(this->__mut_);
this->__sub_wait(__lk);
if (this->__exception_ != nullptr)
- rethrow_exception(this->__exception_);
+ std::rethrow_exception(this->__exception_);
return *__value_;
}
diff --git a/libcxx/include/iomanip b/libcxx/include/iomanip
index 76229fcaa26c1..38c5c9b9c6b22 100644
--- a/libcxx/include/iomanip
+++ b/libcxx/include/iomanip
@@ -311,7 +311,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef money_get<_CharT, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- const _Fp& __mf = use_facet<_Fp>(__is.getloc());
+ const _Fp& __mf = std::use_facet<_Fp>(__is.getloc());
__mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
__is.setstate(__err);
}
@@ -370,7 +370,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
typedef money_put<_CharT, _Op> _Fp;
- const _Fp& __mf = use_facet<_Fp>(__os.getloc());
+ const _Fp& __mf = std::use_facet<_Fp>(__os.getloc());
if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
__os.setstate(ios_base::badbit);
}
@@ -430,7 +430,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef time_get<_CharT, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- const _Fp& __tf = use_facet<_Fp>(__is.getloc());
+ const _Fp& __tf = std::use_facet<_Fp>(__is.getloc());
__tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
__is.setstate(__err);
@@ -490,7 +490,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
typedef time_put<_CharT, _Op> _Fp;
- const _Fp& __tf = use_facet<_Fp>(__os.getloc());
+ const _Fp& __tf = std::use_facet<_Fp>(__os.getloc());
if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
__os.setstate(ios_base::badbit);
diff --git a/libcxx/include/ios b/libcxx/include/ios
index e67b7d2b779a3..9eecf4d8dd8f4 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -766,7 +766,7 @@ inline _LIBCPP_INLINE_VISIBILITY
char
basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
{
- return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
+ return std::use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
}
template <class _CharT, class _Traits>
@@ -774,7 +774,7 @@ inline _LIBCPP_INLINE_VISIBILITY
_CharT
basic_ios<_CharT, _Traits>::widen(char __c) const
{
- return use_facet<ctype<char_type> >(getloc()).widen(__c);
+ return std::use_facet<ctype<char_type> >(getloc()).widen(__c);
}
template <class _CharT, class _Traits>
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 37ba09b63187f..efbcba9f2f26a 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -316,7 +316,7 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
if (!__noskipws && (__is.flags() & ios_base::skipws))
{
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
- const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
_Ip __i(__is);
_Ip __eof;
for (; __i != __eof; ++__i)
@@ -366,7 +366,7 @@ __input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
#endif // _LIBCPP_NO_EXCEPTIONS
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef num_get<_CharT, _Ip> _Fp;
- use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
+ std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -476,7 +476,7 @@ __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef num_get<_CharT, _Ip> _Fp;
long __temp;
- use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp);
+ std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp);
if (__temp < numeric_limits<_Tp>::min())
{
__state |= ios_base::failbit;
@@ -536,7 +536,7 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
{
#endif
_CharT* __s = __p;
- const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
while (__s != __p + (__n-1))
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
@@ -1340,7 +1340,7 @@ ws(basic_istream<_CharT, _Traits>& __is)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
while (true)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
@@ -1461,7 +1461,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
if (__n <= 0)
__n = numeric_limits<streamsize>::max();
streamsize __c = 0;
- const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
while (__c < __n)
{
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
@@ -1556,7 +1556,7 @@ basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
{
- return getline(__is, __str, __is.widen('\n'));
+ return std::getline(__is, __str, __is.widen('\n'));
}
template<class _CharT, class _Traits, class _Allocator>
@@ -1565,7 +1565,7 @@ basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
{
- return getline(__is, __str, __dlm);
+ return std::getline(__is, __str, __dlm);
}
template<class _CharT, class _Traits, class _Allocator>
@@ -1574,7 +1574,7 @@ basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
{
- return getline(__is, __str, __is.widen('\n'));
+ return std::getline(__is, __str, __is.widen('\n'));
}
template <class _CharT, class _Traits, size_t _Size>
@@ -1590,7 +1590,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
{
#endif
basic_string<_CharT, _Traits> __str;
- const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
size_t __c = 0;
_CharT __zero = __ct.widen('0');
_CharT __one = __ct.widen('1');
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 311e866a89102..31804552844f2 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -211,6 +211,9 @@ template <class charT> class messages_byname;
#include <streambuf>
#include <version>
+// TODO: Fix __bsd_locale_defaults.h
+// NOLINTBEGIN(libcpp-robust-against-adl)
+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
// Most unix variants have catopen. These are the specific ones that don't.
# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__)
@@ -446,8 +449,8 @@ string
__num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep)
{
locale __loc = __iob.getloc();
- use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms);
- const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+ std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms);
+ const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
__thousands_sep = __np.thousands_sep();
return __np.grouping();
}
@@ -459,8 +462,8 @@ __num_get<_CharT>::__stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT&
_CharT& __thousands_sep)
{
locale __loc = __iob.getloc();
- use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms);
- const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+ std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms);
+ const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc);
__decimal_point = __np.decimal_point();
__thousands_sep = __np.thousands_sep();
return __np.grouping();
@@ -494,7 +497,7 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
}
return 0;
}
- ptr
diff _t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
+ ptr
diff _t __f = std::find(__atoms, __atoms + 26, __ct) - __atoms;
if (__f >= 24)
return -1;
switch (__base)
@@ -547,7 +550,7 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
}
return 0;
}
- ptr
diff _t __f = find(__atoms, __atoms + 32, __ct) - __atoms;
+ ptr
diff _t __f = std::find(__atoms, __atoms + 32, __ct) - __atoms;
if (__f >= 32)
return -1;
char __x = __src[__f];
@@ -849,7 +852,7 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
__libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
errno = 0;
char *__p2;
- _Tp __ld = __do_strtod<_Tp>(__a, &__p2);
+ _Tp __ld = std::__do_strtod<_Tp>(__a, &__p2);
__libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -892,8 +895,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
}
return __b;
}
- const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__iob.getloc());
- const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__iob.getloc());
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__iob.getloc());
+ const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__iob.getloc());
typedef typename numpunct<_CharT>::string_type string_type;
const string_type __names[2] = {__np.truename(), __np.falsename()};
const string_type* __i = _VSTD::__scan_keyword(__b, __e, __names, __names+2,
@@ -950,7 +953,7 @@ num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e,
if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz)
*__g_end++ = __dc;
// Stage 3
- __v = __num_get_signed_integral<_Signed>(__a, __a_end, __err, __base);
+ __v = std::__num_get_signed_integral<_Signed>(__a, __a_end, __err, __base);
// Digit grouping checked
__check_grouping(__grouping, __g, __g_end, __err);
// EOF checked
@@ -1007,7 +1010,7 @@ num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e,
if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz)
*__g_end++ = __dc;
// Stage 3
- __v = __num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base);
+ __v = std::__num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base);
// Digit grouping checked
__check_grouping(__grouping, __g, __g_end, __err);
// EOF checked
@@ -1062,7 +1065,7 @@ num_get<_CharT, _InputIterator>::__do_get_floating_point(iter_type __b, iter_typ
if (__grouping.size() != 0 && __in_units && __g_end-__g < __num_get_base::__num_get_buf_sz)
*__g_end++ = __dc;
// Stage 3
- __v = __num_get_float<_Fp>(__a, __a_end, __err);
+ __v = std::__num_get_float<_Fp>(__a, __a_end, __err);
// Digit grouping checked
__check_grouping(__grouping, __g, __g_end, __err);
// EOF checked
@@ -1084,8 +1087,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
char_type __atoms[26];
char_type __thousands_sep = 0;
string __grouping;
- use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src,
- __num_get_base::__src + 26, __atoms);
+ std::use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src,
+ __num_get_base::__src + 26, __atoms);
string __buf;
__buf.resize(__buf.capacity());
char* __a = &__buf[0];
@@ -1152,8 +1155,8 @@ __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne,
_CharT* __ob, _CharT*& __op, _CharT*& __oe,
const locale& __loc)
{
- const ctype<_CharT>& __ct = use_facet<ctype<_CharT> > (__loc);
- const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc);
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc);
+ const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
string __grouping = __npt.grouping();
if (__grouping.empty())
{
@@ -1172,7 +1175,7 @@ __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne,
*__oe++ = __ct.widen(*__nf++);
*__oe++ = __ct.widen(*__nf++);
}
- reverse(__nf, __ne);
+ std::reverse(__nf, __ne);
_CharT __thousands_sep = __npt.thousands_sep();
unsigned __dc = 0;
unsigned __dg = 0;
@@ -1189,7 +1192,7 @@ __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne,
*__oe++ = __ct.widen(*__p);
++__dc;
}
- reverse(__ob + (__nf - __nb), __oe);
+ std::reverse(__ob + (__nf - __nb), __oe);
}
if (__np == __ne)
__op = __oe;
@@ -1203,8 +1206,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
_CharT* __ob, _CharT*& __op, _CharT*& __oe,
const locale& __loc)
{
- const ctype<_CharT>& __ct = use_facet<ctype<_CharT> > (__loc);
- const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc);
+ const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc);
+ const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc);
string __grouping = __npt.grouping();
__oe = __ob;
char* __nf = __nb;
@@ -1233,7 +1236,7 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
}
else
{
- reverse(__nf, __ns);
+ std::reverse(__nf, __ns);
_CharT __thousands_sep = __npt.thousands_sep();
unsigned __dc = 0;
unsigned __dg = 0;
@@ -1249,7 +1252,7 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
*__oe++ = __ct.widen(*__p);
++__dc;
}
- reverse(__ob + (__nf - __nb), __oe);
+ std::reverse(__ob + (__nf - __nb), __oe);
}
for (__nf = __ns; __nf < __ne; ++__nf)
{
@@ -1459,7 +1462,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
{
if ((__iob.flags() & ios_base::boolalpha) == 0)
return do_put(__s, __iob, __fl, (unsigned long)__v);
- const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc());
+ const numpunct<char_type>& __np = std::use_facet<numpunct<char_type> >(__iob.getloc());
typedef typename numpunct<char_type>::string_type string_type;
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
string_type __tmp(__v ? __np.truename() : __np.falsename());
@@ -1505,7 +1508,7 @@ num_put<_CharT, _OutputIterator>::__do_put_integral(iter_type __s, ios_base& __i
this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc());
// [__o, __oe) contains thousands_sep'd wide number
// Stage 3 & 4
- return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+ return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
}
template <class _CharT, class _OutputIterator>
@@ -1593,7 +1596,7 @@ num_put<_CharT, _OutputIterator>::__do_put_floating_point(iter_type __s, ios_bas
this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc());
// [__o, __oe) contains thousands_sep'd wide number
// Stage 3 & 4
- __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl);
+ __s = std::__pad_and_output(__s, __ob, __op, __oe, __iob, __fl);
return __s;
}
@@ -1628,7 +1631,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char_type __o[2*(__nbuf-1) - 1];
char_type* __op; // pad here
char_type* __oe; // end of output
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
__ct.widen(__nar, __ne, __o);
__oe = __o + (__ne - __nar);
if (__np == __ne)
@@ -1637,7 +1640,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
__op = __o + (__np - __nar);
// [__o, __oe) contains wide number
// Stage 3 & 4
- return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
+ return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>;
@@ -1923,7 +1926,7 @@ time_get<_CharT, _InputIterator>::__get_month(int& __m,
ios_base::iostate& __err,
const ctype<char_type>& __ct) const
{
- int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1;
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1;
if (!(__err & ios_base::failbit) && 0 <= __t && __t <= 11)
__m = __t;
else
@@ -1937,7 +1940,7 @@ time_get<_CharT, _InputIterator>::__get_year(int& __y,
ios_base::iostate& __err,
const ctype<char_type>& __ct) const
{
- int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4);
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
if (!(__err & ios_base::failbit))
{
if (__t < 69)
@@ -1955,7 +1958,7 @@ time_get<_CharT, _InputIterator>::__get_year4(int& __y,
ios_base::iostate& __err,
const ctype<char_type>& __ct) const
{
- int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4);
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4);
if (!(__err & ios_base::failbit))
__y = __t - 1900;
}
@@ -1967,7 +1970,7 @@ time_get<_CharT, _InputIterator>::__get_hour(int& __h,
ios_base::iostate& __err,
const ctype<char_type>& __ct) const
{
- int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
if (!(__err & ios_base::failbit) && __t <= 23)
__h = __t;
else
@@ -1981,7 +1984,7 @@ time_get<_CharT, _InputIterator>::__get_12_hour(int& __h,
ios_base::iostate& __err,
const ctype<char_type>& __ct) const
{
- int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12)
__h = __t;
else
@@ -1995,7 +1998,7 @@ time_get<_CharT, _InputIterator>::__get_minute(int& __m,
ios_base::iostate& __err,
const ctype<char_type>& __ct) const
{
- int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
if (!(__err & ios_base::failbit) && __t <= 59)
__m = __t;
else
@@ -2009,7 +2012,7 @@ time_get<_CharT, _InputIterator>::__get_second(int& __s,
ios_base::iostate& __err,
const ctype<char_type>& __ct) const
{
- int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
if (!(__err & ios_base::failbit) && __t <= 60)
__s = __t;
else
@@ -2023,7 +2026,7 @@ time_get<_CharT, _InputIterator>::__get_weekday(int& __w,
ios_base::iostate& __err,
const ctype<char_type>& __ct) const
{
- int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 1);
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 1);
if (!(__err & ios_base::failbit) && __t <= 6)
__w = __t;
else
@@ -2037,7 +2040,7 @@ time_get<_CharT, _InputIterator>::__get_day_year_num(int& __d,
ios_base::iostate& __err,
const ctype<char_type>& __ct) const
{
- int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 3);
+ int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 3);
if (!(__err & ios_base::failbit) && __t <= 365)
__d = __t;
else
@@ -2102,7 +2105,7 @@ time_get<_CharT, _InputIterator>::get(iter_type __b, iter_type __e,
ios_base::iostate& __err, tm* __tm,
const char_type* __fmtb, const char_type* __fmte) const
{
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
__err = ios_base::goodbit;
while (__fmtb != __fmte && __err == ios_base::goodbit)
{
@@ -2189,7 +2192,7 @@ time_get<_CharT, _InputIterator>::do_get_weekday(iter_type __b, iter_type __e,
ios_base::iostate& __err,
tm* __tm) const
{
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
__get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct);
return __b;
}
@@ -2201,7 +2204,7 @@ time_get<_CharT, _InputIterator>::do_get_monthname(iter_type __b, iter_type __e,
ios_base::iostate& __err,
tm* __tm) const
{
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
__get_monthname(__tm->tm_mon, __b, __e, __err, __ct);
return __b;
}
@@ -2213,7 +2216,7 @@ time_get<_CharT, _InputIterator>::do_get_year(iter_type __b, iter_type __e,
ios_base::iostate& __err,
tm* __tm) const
{
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
__get_year(__tm->tm_year, __b, __e, __err, __ct);
return __b;
}
@@ -2226,7 +2229,7 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
char __fmt, char) const
{
__err = ios_base::goodbit;
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
switch (__fmt)
{
case 'a':
@@ -2504,7 +2507,7 @@ time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob,
const char_type* __pb,
const char_type* __pe) const
{
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc());
for (; __pb != __pe; ++__pb)
{
if (__ct.narrow(*__pb, 0) == '%')
@@ -2732,7 +2735,7 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
if (__intl)
{
const moneypunct<char_type, true>& __mp =
- use_facet<moneypunct<char_type, true> >(__loc);
+ std::use_facet<moneypunct<char_type, true> >(__loc);
__pat = __mp.neg_format();
__nsn = __mp.negative_sign();
__psn = __mp.positive_sign();
@@ -2745,7 +2748,7 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
else
{
const moneypunct<char_type, false>& __mp =
- use_facet<moneypunct<char_type, false> >(__loc);
+ std::use_facet<moneypunct<char_type, false> >(__loc);
__pat = __mp.neg_format();
__nsn = __mp.negative_sign();
__psn = __mp.positive_sign();
@@ -2829,7 +2832,7 @@ __double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e)
if (__new_cap == 0)
__new_cap = sizeof(_Tp);
size_t __n_off = static_cast<size_t>(__n - __b.get());
- _Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap);
+ _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
if (__t == 0)
__throw_bad_alloc();
if (__owns)
@@ -2944,7 +2947,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
++__sym_space_end;
const size_t __num_spaces = __sym_space_end - __sym.begin();
if (__num_spaces > __spaces.size() ||
- !equal(__spaces.end() - __num_spaces, __spaces.end(),
+ !std::equal(__spaces.end() - __num_spaces, __spaces.end(),
__sym.begin())) {
// No match. Put __sym_space_end back at the
// beginning of __sym, which will prevent a
@@ -2975,14 +2978,14 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
if (__ct.is(ctype_base::digit, __c))
{
if (__wn == __we)
- __double_or_nothing(__wb, __wn, __we);
+ std::__double_or_nothing(__wb, __wn, __we);
*__wn++ = __c;
++__ng;
}
else if (__grp.size() > 0 && __ng > 0 && __c == __ts)
{
if (__gn == __ge)
- __double_or_nothing(__gb, __gn, __ge);
+ std::__double_or_nothing(__gb, __gn, __ge);
*__gn++ = __ng;
__ng = 0;
}
@@ -2992,7 +2995,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
if (__gb.get() != __gn && __ng > 0)
{
if (__gn == __ge)
- __double_or_nothing(__gb, __gn, __ge);
+ std::__double_or_nothing(__gb, __gn, __ge);
*__gn++ = __ng;
}
if (__fd > 0)
@@ -3010,7 +3013,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
return false;
}
if (__wn == __we)
- __double_or_nothing(__wb, __wn, __we);
+ std::__double_or_nothing(__wb, __wn, __we);
*__wn++ = *__b;
}
}
@@ -3060,7 +3063,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
char_type* __wn;
char_type* __we = __wbuf + __bz;
locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc);
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
bool __neg = false;
if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct,
__wb, __wn, __we))
@@ -3081,7 +3084,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
if (__neg)
*__nc++ = '-';
for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc)
- *__nc = __src[find(__atoms, _VSTD::end(__atoms), *__w) - __atoms];
+ *__nc = __src[std::find(__atoms, _VSTD::end(__atoms), *__w) - __atoms];
*__nc = char();
if (sscanf(__nbuf, "%Lf", &__v) != 1)
__throw_runtime_error("money_get error");
@@ -3104,7 +3107,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
char_type* __wn;
char_type* __we = __wbuf + __bz;
locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc);
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
bool __neg = false;
if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct,
__wb, __wn, __we))
@@ -3166,7 +3169,7 @@ __money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc,
if (__intl)
{
const moneypunct<char_type, true>& __mp =
- use_facet<moneypunct<char_type, true> >(__loc);
+ std::use_facet<moneypunct<char_type, true> >(__loc);
if (__neg)
{
__pat = __mp.neg_format();
@@ -3186,7 +3189,7 @@ __money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc,
else
{
const moneypunct<char_type, false>& __mp =
- use_facet<moneypunct<char_type, false> >(__loc);
+ std::use_facet<moneypunct<char_type, false> >(__loc);
if (__neg)
{
__pat = __mp.neg_format();
@@ -3286,7 +3289,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
}
}
// reverse it
- reverse(__t, __me);
+ std::reverse(__t, __me);
}
break;
}
@@ -3378,7 +3381,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
}
// gather info
locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc);
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
__ct.widen(__bb, __bb + __n, __db);
bool __neg = __n > 0 && __bb[0] == '-';
money_base::pattern __pat;
@@ -3410,7 +3413,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
this->__format(__mb, __mi, __me, __iob.flags(),
__db, __db + __n, __ct,
__neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
+ return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
}
template <class _CharT, class _OutputIterator>
@@ -3421,7 +3424,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
{
// gather info
locale __loc = __iob.getloc();
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc);
+ const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc);
bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-');
money_base::pattern __pat;
char_type __dp;
@@ -3452,7 +3455,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
this->__format(__mb, __mi, __me, __iob.flags(),
__digits.data(), __digits.data() + __digits.size(), __ct,
__neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd);
- return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
+ return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
}
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>;
@@ -3539,7 +3542,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
{
#ifdef _LIBCPP_HAS_CATOPEN
string __ndflt;
- __narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
+ __narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__ndflt),
__dflt.c_str(),
__dflt.c_str() + __dflt.size());
if (__c != -1)
@@ -3547,7 +3550,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
nl_catd __cat = (nl_catd)__c;
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
string_type __w;
- __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
+ __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__w),
__n, __n + _VSTD::strlen(__n));
return __w;
#else // !_LIBCPP_HAS_CATOPEN
@@ -3994,7 +3997,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
char_type __1buf;
if (this->gptr() == 0)
this->setg(&__1buf, &__1buf+1, &__1buf+1);
- const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4);
+ const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
int_type __c = traits_type::eof();
if (this->gptr() == this->egptr())
{
@@ -4265,7 +4268,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
{
if (this->gptr() != this->egptr())
{
- reverse(this->gptr(), this->egptr());
+ std::reverse(this->gptr(), this->egptr());
codecvt_base::result __r;
const char_type* __e = this->gptr();
char* __extbe;
@@ -4358,6 +4361,8 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+// NOLINTEND(libcpp-robust-against-adl)
+
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index 51c1a230dc082..5c7c332180bf8 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -352,7 +352,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
unique_lock<_L0> __u0(__l0, try_to_lock);
if (__u0.owns_lock())
{
- __r = try_lock(__l1, __l2, __l3...);
+ __r = std::try_lock(__l1, __l2, __l3...);
if (__r == -1)
__u0.release();
else
@@ -403,7 +403,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
case 0:
{
unique_lock<_L0> __u0(__l0);
- __i = try_lock(__l1, __l2, __l3...);
+ __i = std::try_lock(__l1, __l2, __l3...);
if (__i == -1)
{
__u0.release();
@@ -416,7 +416,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
case 1:
{
unique_lock<_L1> __u1(__l1);
- __i = try_lock(__l2, __l3..., __l0);
+ __i = std::try_lock(__l2, __l3..., __l0);
if (__i == -1)
{
__u1.release();
@@ -430,7 +430,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
__libcpp_thread_yield();
break;
default:
- __lock_first(__i - 2, __l2, __l3..., __l0, __l1);
+ std::__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
return;
}
}
@@ -441,7 +441,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
{
- __lock_first(0, __l0, __l1, __l2, __l3...);
+ std::__lock_first(0, __l0, __l1, __l2, __l3...);
}
template <class _L0>
@@ -667,7 +667,7 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
typedef tuple<_Callable&&, _Args&&...> _Gp;
_Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...);
__call_once_param<_Gp> __p(__f);
- __call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
+ std::__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
}
}
diff --git a/libcxx/include/new b/libcxx/include/new
index ddba2d971eae9..0c826f4a061c0 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -297,9 +297,9 @@ _LIBCPP_INLINE_VISIBILITY
void __do_deallocate_handle_size(void *__ptr, size_t __size, _Args ...__args) {
#ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
(void)__size;
- return __libcpp_operator_delete(__ptr, __args...);
+ return std::__libcpp_operator_delete(__ptr, __args...);
#else
- return __libcpp_operator_delete(__ptr, __size, __args...);
+ return std::__libcpp_operator_delete(__ptr, __size, __args...);
#endif
}
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index 5e2099b236117..acde3709c510f 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -412,7 +412,7 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -439,7 +439,7 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
{
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned short>(__n)) :
@@ -468,7 +468,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -495,7 +495,7 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
{
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned int>(__n)) :
@@ -524,7 +524,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -550,7 +550,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -576,7 +576,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -602,7 +602,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -628,7 +628,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -654,7 +654,7 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -680,7 +680,7 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -706,7 +706,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -732,7 +732,7 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
if (__s)
{
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
- const _Fp& __f = use_facet<_Fp>(this->getloc());
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -759,14 +759,14 @@ __put_character_sequence(basic_ostream<_CharT, _Traits>& __os,
if (__s)
{
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
- if (__pad_and_output(_Ip(__os),
- __str,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ?
- __str + __len :
- __str,
- __str + __len,
- __os,
- __os.fill()).failed())
+ if (std::__pad_and_output(_Ip(__os),
+ __str,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ?
+ __str + __len :
+ __str,
+ __str + __len,
+ __os,
+ __os.fill()).failed())
__os.setstate(ios_base::badbit | ios_base::failbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -800,14 +800,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
{
_CharT __c = __os.widen(__cn);
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
- if (__pad_and_output(_Ip(__os),
- &__c,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ?
- &__c + 1 :
- &__c,
- &__c + 1,
- __os,
- __os.fill()).failed())
+ if (std::__pad_and_output(_Ip(__os),
+ &__c,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ?
+ &__c + 1 :
+ &__c,
+ &__c + 1,
+ __os,
+ __os.fill()).failed())
__os.setstate(ios_base::badbit | ios_base::failbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -874,14 +874,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
}
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
*__p = __os.widen(*__strn);
- if (__pad_and_output(_Ip(__os),
- __wb,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ?
- __wb + __len :
- __wb,
- __wb + __len,
- __os,
- __os.fill()).failed())
+ if (std::__pad_and_output(_Ip(__os),
+ __wb,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ?
+ __wb + __len :
+ __wb,
+ __wb + __len,
+ __os,
+ __os.fill()).failed())
__os.setstate(ios_base::badbit | ios_base::failbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1126,8 +1126,8 @@ _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
{
return __os << __x.template to_string<_CharT, _Traits>
- (use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
- use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
+ (std::use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
+ std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
}
#if _LIBCPP_STD_VER > 17
diff --git a/libcxx/include/regex b/libcxx/include/regex
index f35197339ba9c..365a4c9ac2c8e 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -1157,8 +1157,8 @@ template <class _CharT>
void
regex_traits<_CharT>::__init()
{
- __ct_ = &use_facet<ctype<char_type> >(__loc_);
- __col_ = &use_facet<collate<char_type> >(__loc_);
+ __ct_ = &std::use_facet<ctype<char_type> >(__loc_);
+ __col_ = &std::use_facet<collate<char_type> >(__loc_);
}
template <class _CharT>
@@ -1233,7 +1233,7 @@ regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
string_type __r;
if (!__s.empty())
{
- __r = __get_collation_name(__s.c_str());
+ __r = std::__get_collation_name(__s.c_str());
if (__r.empty() && __s.size() <= 2)
{
__r = __col_->transform(__s.data(), __s.data() + __s.size());
@@ -1296,7 +1296,7 @@ regex_traits<_CharT>::__lookup_classname(_ForwardIterator __f,
{
string_type __s(__f, __l);
__ct_->tolower(&__s[0], &__s[0] + __s.size());
- return __get_classname(__s.c_str(), __icase);
+ return std::__get_classname(__s.c_str(), __icase);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -2094,7 +2094,7 @@ __l_anchor_multiline<_CharT>::__exec(__state& __s) const
}
else if (__multiline_ &&
!__s.__at_first_ &&
- __is_eol(*_VSTD::prev(__s.__current_)))
+ std::__is_eol(*_VSTD::prev(__s.__current_)))
{
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
@@ -2136,7 +2136,7 @@ __r_anchor_multiline<_CharT>::__exec(__state& __s) const
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
}
- else if (__multiline_ && __is_eol(*__s.__current_))
+ else if (__multiline_ && std::__is_eol(*__s.__current_))
{
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
@@ -2405,7 +2405,7 @@ public:
for (size_t __i = 0; __i < __e.size(); ++__i)
__e[__i] = __traits_.translate(__e[__i]);
}
- __ranges_.push_back(make_pair(
+ __ranges_.push_back(std::make_pair(
__traits_.transform(__b.begin(), __b.end()),
__traits_.transform(__e.begin(), __e.end())));
}
@@ -2418,20 +2418,20 @@ public:
__b[0] = __traits_.translate_nocase(__b[0]);
__e[0] = __traits_.translate_nocase(__e[0]);
}
- __ranges_.push_back(make_pair(_VSTD::move(__b), _VSTD::move(__e)));
+ __ranges_.push_back(std::make_pair(_VSTD::move(__b), _VSTD::move(__e)));
}
}
_LIBCPP_INLINE_VISIBILITY
void __add_digraph(_CharT __c1, _CharT __c2)
{
if (__icase_)
- __digraphs_.push_back(make_pair(__traits_.translate_nocase(__c1),
- __traits_.translate_nocase(__c2)));
+ __digraphs_.push_back(std::make_pair(__traits_.translate_nocase(__c1),
+ __traits_.translate_nocase(__c2)));
else if (__collate_)
- __digraphs_.push_back(make_pair(__traits_.translate(__c1),
- __traits_.translate(__c2)));
+ __digraphs_.push_back(std::make_pair(__traits_.translate(__c1),
+ __traits_.translate(__c2)));
else
- __digraphs_.push_back(make_pair(__c1, __c2));
+ __digraphs_.push_back(std::make_pair(__c1, __c2));
}
_LIBCPP_INLINE_VISIBILITY
void __add_equivalence(const string_type& __s)
@@ -5523,7 +5523,7 @@ public:
regex_constants::match_flag_type __flags = regex_constants::format_default) const
{
basic_string<char_type, _ST, _SA> __r;
- format(back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(),
+ format(std::back_inserter(__r), __fmt.data(), __fmt.data() + __fmt.size(),
__flags);
return __r;
}
@@ -5533,7 +5533,7 @@ public:
regex_constants::match_flag_type __flags = regex_constants::format_default) const
{
string_type __r;
- format(back_inserter(__r), __fmt,
+ format(std::back_inserter(__r), __fmt,
__fmt + char_traits<char_type>::length(__fmt), __flags);
return __r;
}
@@ -6794,7 +6794,7 @@ regex_replace(const basic_string<_CharT, _ST, _SA>& __s,
regex_constants::match_flag_type __flags = regex_constants::match_default)
{
basic_string<_CharT, _ST, _SA> __r;
- _VSTD::regex_replace(back_inserter(__r), __s.begin(), __s.end(), __e,
+ _VSTD::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e,
__fmt.c_str(), __flags);
return __r;
}
@@ -6807,7 +6807,7 @@ regex_replace(const basic_string<_CharT, _ST, _SA>& __s,
regex_constants::match_flag_type __flags = regex_constants::match_default)
{
basic_string<_CharT, _ST, _SA> __r;
- _VSTD::regex_replace(back_inserter(__r), __s.begin(), __s.end(), __e,
+ _VSTD::regex_replace(std::back_inserter(__r), __s.begin(), __s.end(), __e,
__fmt, __flags);
return __r;
}
@@ -6821,7 +6821,7 @@ regex_replace(const _CharT* __s,
regex_constants::match_flag_type __flags = regex_constants::match_default)
{
basic_string<_CharT> __r;
- _VSTD::regex_replace(back_inserter(__r), __s,
+ _VSTD::regex_replace(std::back_inserter(__r), __s,
__s + char_traits<_CharT>::length(__s), __e,
__fmt.c_str(), __flags);
return __r;
@@ -6836,7 +6836,7 @@ regex_replace(const _CharT* __s,
regex_constants::match_flag_type __flags = regex_constants::match_default)
{
basic_string<_CharT> __r;
- _VSTD::regex_replace(back_inserter(__r), __s,
+ _VSTD::regex_replace(std::back_inserter(__r), __s,
__s + char_traits<_CharT>::length(__s), __e,
__fmt, __flags);
return __r;
diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator
index d450f4f9e443b..56cb9ee40cdba 100644
--- a/libcxx/include/scoped_allocator
+++ b/libcxx/include/scoped_allocator
@@ -373,7 +373,7 @@ template <class _Alloc>
struct __has_outer_allocator
: public common_type
<
- decltype(__has_outer_allocator_test(declval<_Alloc&>()))
+ decltype(std::__has_outer_allocator_test(declval<_Alloc&>()))
>::type
{
};
diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore
index 3e4f51cae58fc..ddccb28dab470 100644
--- a/libcxx/include/semaphore
+++ b/libcxx/include/semaphore
@@ -113,7 +113,7 @@ public:
if (__rel_time == chrono::duration<Rep, Period>::zero())
return try_acquire();
auto const __test_fn = [this]() { return try_acquire(); };
- return __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time);
+ return std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy(), __rel_time);
}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
bool try_acquire()
diff --git a/libcxx/include/string b/libcxx/include/string
index bcd38b101b3e5..9f5838d425838 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -3480,7 +3480,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr");
- return __str_find<value_type, size_type, traits_type, npos>
+ return std::__str_find<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3490,7 +3490,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
size_type __pos) const _NOEXCEPT
{
- return __str_find<value_type, size_type, traits_type, npos>
+ return std::__str_find<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
}
@@ -3506,7 +3506,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t,
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
- return __str_find<value_type, size_type, traits_type, npos>
+ return std::__str_find<value_type, size_type, traits_type, npos>
(data(), size(), __sv.data(), __pos, __sv.size());
}
@@ -3517,7 +3517,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr");
- return __str_find<value_type, size_type, traits_type, npos>
+ return std::__str_find<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3527,7 +3527,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
size_type __pos) const _NOEXCEPT
{
- return __str_find<value_type, size_type, traits_type, npos>
+ return std::__str_find<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
}
@@ -3541,7 +3541,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
- return __str_rfind<value_type, size_type, traits_type, npos>
+ return std::__str_rfind<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3551,7 +3551,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
size_type __pos) const _NOEXCEPT
{
- return __str_rfind<value_type, size_type, traits_type, npos>
+ return std::__str_rfind<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
}
@@ -3567,7 +3567,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t,
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
- return __str_rfind<value_type, size_type, traits_type, npos>
+ return std::__str_rfind<value_type, size_type, traits_type, npos>
(data(), size(), __sv.data(), __pos, __sv.size());
}
@@ -3578,7 +3578,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr");
- return __str_rfind<value_type, size_type, traits_type, npos>
+ return std::__str_rfind<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3588,7 +3588,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
size_type __pos) const _NOEXCEPT
{
- return __str_rfind<value_type, size_type, traits_type, npos>
+ return std::__str_rfind<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
}
@@ -3602,7 +3602,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
- return __str_find_first_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3612,7 +3612,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,
size_type __pos) const _NOEXCEPT
{
- return __str_find_first_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
}
@@ -3628,7 +3628,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t,
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
- return __str_find_first_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __sv.data(), __pos, __sv.size());
}
@@ -3639,7 +3639,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr");
- return __str_find_first_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3662,7 +3662,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
- return __str_find_last_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3672,7 +3672,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,
size_type __pos) const _NOEXCEPT
{
- return __str_find_last_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
}
@@ -3688,7 +3688,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t,
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
- return __str_find_last_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __sv.data(), __pos, __sv.size());
}
@@ -3699,7 +3699,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr");
- return __str_find_last_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3722,7 +3722,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
- return __str_find_first_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3732,7 +3732,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,
size_type __pos) const _NOEXCEPT
{
- return __str_find_first_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
}
@@ -3748,7 +3748,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t,
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
- return __str_find_first_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __sv.data(), __pos, __sv.size());
}
@@ -3759,7 +3759,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr");
- return __str_find_first_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3769,7 +3769,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
size_type __pos) const _NOEXCEPT
{
- return __str_find_first_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
}
@@ -3783,7 +3783,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
- return __str_find_last_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3793,7 +3793,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,
size_type __pos) const _NOEXCEPT
{
- return __str_find_last_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __str.data(), __pos, __str.size());
}
@@ -3809,7 +3809,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t,
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
- return __str_find_last_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __sv.data(), __pos, __sv.size());
}
@@ -3820,7 +3820,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
size_type __pos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr");
- return __str_find_last_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3830,7 +3830,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
size_type __pos) const _NOEXCEPT
{
- return __str_find_last_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
}
@@ -4449,7 +4449,7 @@ struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<
{
size_t
operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT
- { return __do_string_hash(__val.data(), __val.data() + __val.size()); }
+ { return std::__do_string_hash(__val.data(), __val.data() + __val.size()); }
};
template <class _Allocator>
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 3ec086e69b568..ea98e38de8719 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -493,14 +493,14 @@ public:
size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
- return __str_find<value_type, size_type, traits_type, npos>
+ return std::__str_find<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
{
- return __str_find<value_type, size_type, traits_type, npos>
+ return std::__str_find<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
}
@@ -508,7 +508,7 @@ public:
size_type find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): received nullptr");
- return __str_find<value_type, size_type, traits_type, npos>
+ return std::__str_find<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -516,7 +516,7 @@ public:
size_type find(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find(): received nullptr");
- return __str_find<value_type, size_type, traits_type, npos>
+ return std::__str_find<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -525,14 +525,14 @@ public:
size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
- return __str_rfind<value_type, size_type, traits_type, npos>
+ return std::__str_rfind<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
{
- return __str_rfind<value_type, size_type, traits_type, npos>
+ return std::__str_rfind<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
}
@@ -540,7 +540,7 @@ public:
size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr");
- return __str_rfind<value_type, size_type, traits_type, npos>
+ return std::__str_rfind<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -548,7 +548,7 @@ public:
size_type rfind(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): received nullptr");
- return __str_rfind<value_type, size_type, traits_type, npos>
+ return std::__str_rfind<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -557,7 +557,7 @@ public:
size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr");
- return __str_find_first_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
@@ -569,7 +569,7 @@ public:
size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr");
- return __str_find_first_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -577,7 +577,7 @@ public:
size_type find_first_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): received nullptr");
- return __str_find_first_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -586,7 +586,7 @@ public:
size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr");
- return __str_find_last_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
@@ -598,7 +598,7 @@ public:
size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr");
- return __str_find_last_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -606,7 +606,7 @@ public:
size_type find_last_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): received nullptr");
- return __str_find_last_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -615,14 +615,14 @@ public:
size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr");
- return __str_find_first_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
{
- return __str_find_first_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
}
@@ -630,7 +630,7 @@ public:
size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr");
- return __str_find_first_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -638,7 +638,7 @@ public:
size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): received nullptr");
- return __str_find_first_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -647,14 +647,14 @@ public:
size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr");
- return __str_find_last_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
{
- return __str_find_last_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __c, __pos);
}
@@ -662,7 +662,7 @@ public:
size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr");
- return __str_find_last_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -670,7 +670,7 @@ public:
size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): received nullptr");
- return __str_find_last_not_of<value_type, size_type, traits_type, npos>
+ return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -953,7 +953,7 @@ struct __string_view_hash : public __unary_function<basic_string_view<_CharT, ch
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
- return __do_string_hash(__val.data(), __val.data() + __val.size());
+ return std::__do_string_hash(__val.data(), __val.data() + __val.size());
}
};
diff --git a/libcxx/include/thread b/libcxx/include/thread
index 7c6d4f8828c0a..7a1117f555a7e 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -199,7 +199,7 @@ __thread_specific_ptr<_Tp>::set_pointer(pointer __p)
{
_LIBCPP_ASSERT(get() == nullptr,
"Attempting to overwrite thread local data");
- __libcpp_tls_set(__key_, __p);
+ std::__libcpp_tls_set(__key_, __p);
}
template<>
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index a14d90365959d..7149875be4bef 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -1397,7 +1397,7 @@ template <size_t _Nx>
inline _LIBCPP_INLINE_VISIBILITY
constexpr size_t __find_idx(size_t __i, const bool (&__matches)[_Nx]) {
return __i == _Nx ? __not_found :
- __find_idx_return(__i, __find_idx(__i + 1, __matches), __matches[__i]);
+ __find_detail::__find_idx_return(__i, __find_detail::__find_idx(__i + 1, __matches), __matches[__i]);
}
template <class _T1, class ..._Args>
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index cd0aea1205d52..14f93bab36e13 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -1149,7 +1149,7 @@ public:
#endif
_LIBCPP_INLINE_VISIBILITY
~unordered_map() {
- static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
}
_LIBCPP_INLINE_VISIBILITY
@@ -2041,7 +2041,7 @@ private:
#endif
_LIBCPP_INLINE_VISIBILITY
~unordered_multimap() {
- static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
}
_LIBCPP_INLINE_VISIBILITY
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index 9a25510139428..b4203c08a9b9b 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -613,7 +613,7 @@ public:
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
~unordered_set() {
- static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
}
_LIBCPP_INLINE_VISIBILITY
@@ -1267,7 +1267,7 @@ public:
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
~unordered_multiset() {
- static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
+ static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
}
_LIBCPP_INLINE_VISIBILITY
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index 11a273d993a18..5b1f02312dd1f 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -546,7 +546,7 @@ struct __abs_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return abs(__x);}
+ {return std::abs(__x);}
};
template <class _Tp>
@@ -555,7 +555,7 @@ struct __acos_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return acos(__x);}
+ {return std::acos(__x);}
};
template <class _Tp>
@@ -564,7 +564,7 @@ struct __asin_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return asin(__x);}
+ {return std::asin(__x);}
};
template <class _Tp>
@@ -573,7 +573,7 @@ struct __atan_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return atan(__x);}
+ {return std::atan(__x);}
};
template <class _Tp>
@@ -582,7 +582,7 @@ struct __atan2_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return atan2(__x, __y);}
+ {return std::atan2(__x, __y);}
};
template <class _Tp>
@@ -591,7 +591,7 @@ struct __cos_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return cos(__x);}
+ {return std::cos(__x);}
};
template <class _Tp>
@@ -600,7 +600,7 @@ struct __cosh_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return cosh(__x);}
+ {return std::cosh(__x);}
};
template <class _Tp>
@@ -609,7 +609,7 @@ struct __exp_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return exp(__x);}
+ {return std::exp(__x);}
};
template <class _Tp>
@@ -618,7 +618,7 @@ struct __log_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return log(__x);}
+ {return std::log(__x);}
};
template <class _Tp>
@@ -627,7 +627,7 @@ struct __log10_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return log10(__x);}
+ {return std::log10(__x);}
};
template <class _Tp>
@@ -636,7 +636,7 @@ struct __pow_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x, const _Tp& __y) const
- {return pow(__x, __y);}
+ {return std::pow(__x, __y);}
};
template <class _Tp>
@@ -645,7 +645,7 @@ struct __sin_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return sin(__x);}
+ {return std::sin(__x);}
};
template <class _Tp>
@@ -654,7 +654,7 @@ struct __sinh_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return sinh(__x);}
+ {return std::sinh(__x);}
};
template <class _Tp>
@@ -663,7 +663,7 @@ struct __sqrt_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return sqrt(__x);}
+ {return std::sqrt(__x);}
};
template <class _Tp>
@@ -672,7 +672,7 @@ struct __tan_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return tan(__x);}
+ {return std::tan(__x);}
};
template <class _Tp>
@@ -681,7 +681,7 @@ struct __tanh_expr
typedef _Tp __result_type;
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
- {return tanh(__x);}
+ {return std::tanh(__x);}
};
template <class _ValExpr>
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 26835f327da57..001b86f746605 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -436,24 +436,24 @@ constexpr _Trait __common_trait(initializer_list<_Trait> __traits) {
template <typename... _Types>
struct __traits {
static constexpr _Trait __copy_constructible_trait =
- __common_trait({__trait<_Types,
+ __variant_detail::__common_trait({__trait<_Types,
is_trivially_copy_constructible,
is_copy_constructible>...});
static constexpr _Trait __move_constructible_trait =
- __common_trait({__trait<_Types,
+ __variant_detail::__common_trait({__trait<_Types,
is_trivially_move_constructible,
is_move_constructible>...});
- static constexpr _Trait __copy_assignable_trait = __common_trait(
+ static constexpr _Trait __copy_assignable_trait = __variant_detail::__common_trait(
{__copy_constructible_trait,
__trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...});
- static constexpr _Trait __move_assignable_trait = __common_trait(
+ static constexpr _Trait __move_assignable_trait = __variant_detail::__common_trait(
{__move_constructible_trait,
__trait<_Types, is_trivially_move_assignable, is_move_assignable>...});
- static constexpr _Trait __destructible_trait = __common_trait(
+ static constexpr _Trait __destructible_trait = __variant_detail::__common_trait(
{__trait<_Types, is_trivially_destructible, is_destructible>...});
};
@@ -1484,7 +1484,7 @@ constexpr bool __holds_alternative(const variant<_Types...>& __v) noexcept {
template <class _Tp, class... _Types>
_LIBCPP_HIDE_FROM_ABI
constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept {
- return __holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
+ return std::__holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <size_t _Ip, class _Vp>
@@ -1492,7 +1492,7 @@ _LIBCPP_HIDE_FROM_ABI
_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr auto&& __generic_get(_Vp&& __v) {
using __variant_detail::__access::__variant;
- if (!__holds_alternative<_Ip>(__v)) {
+ if (!std::__holds_alternative<_Ip>(__v)) {
__throw_bad_variant_access();
}
return __variant::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v)).__value;
@@ -1505,7 +1505,7 @@ constexpr variant_alternative_t<_Ip, variant<_Types...>>& get(
variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return __generic_get<_Ip>(__v);
+ return std::__generic_get<_Ip>(__v);
}
template <size_t _Ip, class... _Types>
@@ -1515,7 +1515,7 @@ constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get(
variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return __generic_get<_Ip>(_VSTD::move(__v));
+ return std::__generic_get<_Ip>(_VSTD::move(__v));
}
template <size_t _Ip, class... _Types>
@@ -1525,7 +1525,7 @@ constexpr const variant_alternative_t<_Ip, variant<_Types...>>& get(
const variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return __generic_get<_Ip>(__v);
+ return std::__generic_get<_Ip>(__v);
}
template <size_t _Ip, class... _Types>
@@ -1535,7 +1535,7 @@ constexpr const variant_alternative_t<_Ip, variant<_Types...>>&& get(
const variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return __generic_get<_Ip>(_VSTD::move(__v));
+ return std::__generic_get<_Ip>(_VSTD::move(__v));
}
template <class _Tp, class... _Types>
@@ -1576,7 +1576,7 @@ template <size_t _Ip, class _Vp>
_LIBCPP_HIDE_FROM_ABI
constexpr auto* __generic_get_if(_Vp* __v) noexcept {
using __variant_detail::__access::__variant;
- return __v && __holds_alternative<_Ip>(*__v)
+ return __v && std::__holds_alternative<_Ip>(*__v)
? _VSTD::addressof(__variant::__get_alt<_Ip>(*__v).__value)
: nullptr;
}
@@ -1587,7 +1587,7 @@ constexpr add_pointer_t<variant_alternative_t<_Ip, variant<_Types...>>>
get_if(variant<_Types...>* __v) noexcept {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return __generic_get_if<_Ip>(__v);
+ return std::__generic_get_if<_Ip>(__v);
}
template <size_t _Ip, class... _Types>
@@ -1596,7 +1596,7 @@ constexpr add_pointer_t<const variant_alternative_t<_Ip, variant<_Types...>>>
get_if(const variant<_Types...>* __v) noexcept {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return __generic_get_if<_Ip>(__v);
+ return std::__generic_get_if<_Ip>(__v);
}
template <class _Tp, class... _Types>
@@ -1782,7 +1782,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<
return hash<__value_type>{}(__alt.__value);
},
__v);
- return __hash_combine(__res, hash<size_t>{}(__v.index()));
+ return std::__hash_combine(__res, hash<size_t>{}(__v.index()));
}
};
@@ -1799,13 +1799,13 @@ constexpr auto&& __unchecked_get(_Vp&& __v) noexcept {
template <class _Tp, class... _Types>
_LIBCPP_HIDE_FROM_ABI
constexpr auto&& __unchecked_get(const variant<_Types...>& __v) noexcept {
- return __unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
+ return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
template <class _Tp, class... _Types>
_LIBCPP_HIDE_FROM_ABI
constexpr auto&& __unchecked_get(variant<_Types...>& __v) noexcept {
- return __unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
+ return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
}
#endif // _LIBCPP_STD_VER > 14
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index dd96a57b6181e..78d3e2f791495 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_subdirectory(tools)
+
# By default, libcxx and libcxxabi share a library directory.
if (NOT LIBCXX_CXX_ABI_LIBRARY_PATH)
set(LIBCXX_CXX_ABI_LIBRARY_PATH "${LIBCXX_LIBRARY_DIR}" CACHE PATH
diff --git a/libcxx/test/configs/cmake-bridge.cfg.in b/libcxx/test/configs/cmake-bridge.cfg.in
index df58522d6cbb2..e2c86f7c7c3fa 100644
--- a/libcxx/test/configs/cmake-bridge.cfg.in
+++ b/libcxx/test/configs/cmake-bridge.cfg.in
@@ -30,3 +30,4 @@ config.substitutions.append(('%{include}', '@LIBCXX_GENERATED_INCLUDE_DIR@'))
config.substitutions.append(('%{target-include}', '@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@'))
config.substitutions.append(('%{lib}', '@LIBCXX_LIBRARY_DIR@'))
config.substitutions.append(('%{executor}', '@LIBCXX_EXECUTOR@'))
+config.substitutions.append(('%{test-tools}', '@LIBCXX_TEST_TOOLS_PATH@'))
diff --git a/libcxx/test/libcxx/clang_tidy.sh.cpp b/libcxx/test/libcxx/clang_tidy.sh.cpp
index 23c523ffc70d4..70a9026eafb81 100644
--- a/libcxx/test/libcxx/clang_tidy.sh.cpp
+++ b/libcxx/test/libcxx/clang_tidy.sh.cpp
@@ -12,6 +12,7 @@
// UNSUPPORTED: gcc
// TODO: run clang-tidy with modules enabled once they are supported
+// RUN: clang-tidy %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin -- %{compile_flags} -fno-modules
// RUN: clang-tidy %s --warnings-as-errors=* -header-filter=.* --config-file=%S/../../.clang-tidy -- -Wweak-vtables %{compile_flags} -fno-modules
// Prevent <ext/hash_map> from generating deprecated warnings for this test.
diff --git a/libcxx/test/tools/CMakeLists.txt b/libcxx/test/tools/CMakeLists.txt
new file mode 100644
index 0000000000000..10be63e8b50aa
--- /dev/null
+++ b/libcxx/test/tools/CMakeLists.txt
@@ -0,0 +1,7 @@
+
+set(LIBCXX_TEST_TOOLS_PATH ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
+
+# TODO: Remove LIBCXX_ENABLE_CLANG_TIDY
+if(LIBCXX_ENABLE_CLANG_TIDY)
+ add_subdirectory(clang_tidy_checks)
+endif()
diff --git a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
new file mode 100644
index 0000000000000..4599f5b80e598
--- /dev/null
+++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
@@ -0,0 +1,42 @@
+
+# Look for the latest package
+set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
+set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
+
+find_package(Clang 16)
+
+set(SOURCES
+ robust_against_adl.cpp
+ libcpp_module.cpp)
+
+
+if(NOT Clang_FOUND)
+ message(STATUS "Could not find a suitable version of the Clang development package;
+ custom libc++ clang-tidy checks will not be available.")
+ return()
+endif()
+
+message(STATUS "Found system-installed LLVM ${LLVM_PACKAGE_VERSION} with headers in ${LLVM_INCLUDE_DIRS}")
+
+set(CMAKE_CXX_STANDARD 20)
+
+# Link only against clangTidy itself, not anything that clangTidy uses; otherwise we run setup code multiple times
+# which results in clang-tidy crashing
+set_target_properties(clangTidy PROPERTIES INTERFACE_LINK_LIBRARIES "")
+# ClangTargets.cmake doesn't set the include paths, so we have to do it
+target_include_directories(clangTidy INTERFACE
+ ${CLANG_INCLUDE_DIRS}
+ ${LLVM_INCLUDE_DIRS}
+ )
+target_compile_options(clangTidy INTERFACE -fno-rtti)
+
+add_library(cxx-tidy MODULE ${SOURCES})
+target_link_libraries(cxx-tidy clangTidy)
+
+set_target_properties(cxx-tidy PROPERTIES
+ CXX_STANDARD 20
+ CXX_STANDARD_REQUIRED YES
+ CXX_EXTENSIONS NO)
+
+set_target_properties(cxx-tidy PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+set(CMAKE_SHARED_MODULE_SUFFIX_CXX .plugin) # Use a portable suffix to simplify how we can find it from Lit
diff --git a/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp b/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp
new file mode 100644
index 0000000000000..52057592a845e
--- /dev/null
+++ b/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang-tidy/ClangTidyModule.h"
+#include "clang-tidy/ClangTidyModuleRegistry.h"
+#include "robust_against_adl.hpp"
+
+namespace {
+class LibcxxTestModule : public clang::tidy::ClangTidyModule {
+public:
+ void addCheckFactories(clang::tidy::ClangTidyCheckFactories& check_factories) override {
+ check_factories.registerCheck<libcpp::robust_against_adl_check>("libcpp-robust-against-adl");
+ }
+};
+} // namespace
+
+clang::tidy::ClangTidyModuleRegistry::Add<LibcxxTestModule> libcpp_module{
+ "libcpp-module", "Adds libc++-specific checks."};
diff --git a/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp
new file mode 100644
index 0000000000000..8825c3b77ef9a
--- /dev/null
+++ b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang-tidy/ClangTidyCheck.h"
+#include "clang-tidy/ClangTidyModuleRegistry.h"
+
+#include "robust_against_adl.hpp"
+
+#include <algorithm>
+
+namespace {
+AST_MATCHER(clang::UnresolvedLookupExpr, requiresADL) { return Node.requiresADL(); }
+
+AST_MATCHER(clang::CallExpr, isOperator) { return llvm::isa<clang::CXXOperatorCallExpr>(Node); }
+
+AST_MATCHER(clang::UnresolvedLookupExpr, isCustomizationPoint) {
+ return std::ranges::any_of(
+ std::array{"swap", "make_error_code", "make_error_condition", "begin", "end", "size", "rend", "rbegin"},
+ [&](const char* func) { return Node.getName().getAsString() == func; });
+}
+
+AST_MATCHER(clang::CXXMethodDecl, isStatic) { return Node.isStatic(); }
+
+} // namespace
+
+namespace libcpp {
+robust_against_adl_check::robust_against_adl_check(llvm::StringRef name, clang::tidy::ClangTidyContext* context)
+ : clang::tidy::ClangTidyCheck(name, context) {}
+
+void robust_against_adl_check::registerMatchers(clang::ast_matchers::MatchFinder* finder) {
+ using namespace clang::ast_matchers;
+ finder->addMatcher(
+ callExpr(unless(isOperator()),
+ unless(argumentCountIs(0)),
+ has(unresolvedLookupExpr(requiresADL(), unless(isCustomizationPoint()))),
+ unless(callee(cxxMethodDecl(isStatic()))))
+ .bind("ADLcall"),
+ this);
+}
+
+void robust_against_adl_check::check(const clang::ast_matchers::MatchFinder::MatchResult& result) {
+ if (const auto* call = result.Nodes.getNodeAs<clang::CallExpr>("ADLcall"); call != nullptr) {
+ diag(call->getBeginLoc(), "ADL lookup");
+ }
+}
+} // namespace libcpp
diff --git a/libcxx/test/tools/clang_tidy_checks/robust_against_adl.hpp b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.hpp
new file mode 100644
index 0000000000000..68b64c4873441
--- /dev/null
+++ b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.hpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang-tidy/ClangTidyCheck.h"
+
+namespace libcpp {
+class robust_against_adl_check : public clang::tidy::ClangTidyCheck {
+public:
+ robust_against_adl_check(llvm::StringRef, clang::tidy::ClangTidyContext*);
+ void registerMatchers(clang::ast_matchers::MatchFinder*) override;
+ void check(const clang::ast_matchers::MatchFinder::MatchResult&) override;
+};
+} // namespace libcpp
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 0ea86362424c6..b1893430b2a0b 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -743,7 +743,7 @@ steps:
- group: ":apple: Apple"
steps:
- label: "MacOS x86_64"
- command: "libcxx/utils/ci/run-buildbot generic-cxx20"
+ command: "libcxx/utils/ci/run-buildbot apple-cxx20"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
@@ -758,7 +758,7 @@ steps:
timeout_in_minutes: 120
- label: "MacOS arm64"
- command: "libcxx/utils/ci/run-buildbot generic-cxx20"
+ command: "libcxx/utils/ci/run-buildbot apple-cxx20"
artifact_paths:
- "**/test-results.xml"
- "**/*.abilist"
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index eb72ed4e44c5c..3ee025c19e06b 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -226,37 +226,43 @@ check-generated-output)
#
generic-cxx03)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake" \
+ -DLIBCXX_ENABLE_CLANG_TIDY=ON
check-runtimes
check-abi-list
;;
generic-cxx11)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
+ -DLIBCXX_ENABLE_CLANG_TIDY=ON
check-runtimes
check-abi-list
;;
generic-cxx14)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake" \
+ -DLIBCXX_ENABLE_CLANG_TIDY=ON
check-runtimes
check-abi-list
;;
generic-cxx17)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake" \
+ -DLIBCXX_ENABLE_CLANG_TIDY=ON
check-runtimes
check-abi-list
;;
generic-cxx20)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake" \
+ -DLIBCXX_ENABLE_CLANG_TIDY=ON
check-runtimes
check-abi-list
;;
generic-cxx2b)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx2b.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx2b.cmake" \
+ -DLIBCXX_ENABLE_CLANG_TIDY=ON
check-runtimes
check-abi-list
;;
@@ -414,7 +420,8 @@ generic-no-experimental)
;;
generic-noexceptions)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake"
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake" \
+ -DLIBCXX_ENABLE_CLANG_TIDY=ON
check-runtimes
check-abi-list
;;
@@ -426,6 +433,12 @@ generic-abi-unstable)
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake"
check-runtimes
;;
+apple-cxx20)
+ clean
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake"
+ check-runtimes
+ check-abi-list
+;;
apple-system)
clean
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 7843e5dc8a9f8..f122c75aa6799 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -20,7 +20,8 @@
def _hasSuitableClangTidy(cfg):
try:
- return int(re.search('[0-9]+', commandOutput(cfg, ['clang-tidy --version'])).group()) >= 13
+ return int(re.search('[0-9]+', commandOutput(cfg, ['clang-tidy --version'])).group()) >= 13 and runScriptExitCode(
+ cfg, ['stat %{test-tools}/clang_tidy_checks/libcxx-tidy.plugin']) == 0
except ConfigurationRuntimeError:
return False
More information about the libcxx-commits
mailing list