diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -103,6 +103,7 @@ 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") diff --git a/libcxx/include/__algorithm/ranges_search_n.h b/libcxx/include/__algorithm/ranges_search_n.h --- a/libcxx/include/__algorithm/ranges_search_n.h +++ b/libcxx/include/__algorithm/ranges_search_n.h @@ -53,12 +53,8 @@ } 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 --- a/libcxx/include/__algorithm/sort.h +++ b/libcxx/include/__algorithm/sort.h @@ -626,7 +626,7 @@ template <class _WrappedComp, class _RandomAccessIterator> _LIBCPP_HIDDEN void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; - difference_type __depth_limit = 2 * __log2i(__last - __first); + difference_type __depth_limit = 2 * std::__log2i(__last - __first); using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>; using _AlgPolicy = typename _Unwrap::_AlgPolicy; diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference --- a/libcxx/include/__bit_reference +++ b/libcxx/include/__bit_reference @@ -88,7 +88,7 @@ _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 @@ {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 --- a/libcxx/include/__chrono/duration.h +++ b/libcxx/include/__chrono/duration.h @@ -151,7 +151,7 @@ >::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 @@ >::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 @@ >::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 --- a/libcxx/include/__chrono/formatter.h +++ b/libcxx/include/__chrono/formatter.h @@ -195,7 +195,7 @@ // 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 --- a/libcxx/include/__chrono/hh_mm_ss.h +++ b/libcxx/include/__chrono/hh_mm_ss.h @@ -58,10 +58,10 @@ _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 --- a/libcxx/include/__chrono/time_point.h +++ b/libcxx/include/__chrono/time_point.h @@ -98,7 +98,7 @@ >::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 @@ >::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 @@ >::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 --- a/libcxx/include/__compare/common_comparison_category.h +++ b/libcxx/include/__compare/common_comparison_category.h @@ -64,7 +64,7 @@ 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 --- a/libcxx/include/__compare/partial_order.h +++ b/libcxx/include/__compare/partial_order.h @@ -28,6 +28,7 @@ // [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 @@ -35,6 +36,7 @@ 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 --- a/libcxx/include/__compare/strong_order.h +++ b/libcxx/include/__compare/strong_order.h @@ -34,6 +34,7 @@ // [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 @@ -41,6 +42,7 @@ 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 --- a/libcxx/include/__compare/weak_order.h +++ b/libcxx/include/__compare/weak_order.h @@ -29,6 +29,7 @@ // [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 @@ 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 --- a/libcxx/include/__filesystem/path.h +++ b/libcxx/include/__filesystem/path.h @@ -619,7 +619,7 @@ _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 @@ 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 @@ 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 --- a/libcxx/include/__format/format_arg_store.h +++ b/libcxx/include/__format/format_arg_store.h @@ -198,7 +198,7 @@ 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 @@ 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 --- a/libcxx/include/__format/format_functions.h +++ b/libcxx/include/__format/format_functions.h @@ -305,7 +305,7 @@ 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 --- a/libcxx/include/__format/format_string.h +++ b/libcxx/include/__format/format_string.h @@ -73,7 +73,7 @@ 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 --- a/libcxx/include/__format/formatter_floating_point.h +++ b/libcxx/include/__format/formatter_floating_point.h @@ -498,7 +498,7 @@ 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 --- a/libcxx/include/__format/formatter_integral.h +++ b/libcxx/include/__format/formatter_integral.h @@ -217,7 +217,7 @@ # 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(); ptrdiff_t __size = __last - __first; // Writing the grouped form has more overhead than the normal output @@ -310,7 +310,7 @@ 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 @@ -> 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 --- a/libcxx/include/__format/formatter_output.h +++ b/libcxx/include/__format/formatter_output.h @@ -171,7 +171,7 @@ } 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 @@ 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_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 @@ 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 @@ // 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 @@ // 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 --- a/libcxx/include/__format/parser_std_format_spec.h +++ b/libcxx/include/__format/parser_std_format_spec.h @@ -878,7 +878,7 @@ // 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; @@ -886,12 +886,12 @@ 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 --- a/libcxx/include/__functional/hash.h +++ b/libcxx/include/__functional/hash.h @@ -63,7 +63,7 @@ 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; @@ -128,13 +128,13 @@ _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) { @@ -152,10 +152,10 @@ 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); } @@ -180,10 +180,10 @@ 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); } @@ -192,23 +192,23 @@ 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); @@ -234,26 +234,26 @@ // 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 --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -565,7 +565,7 @@ _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 @@ _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 @@ _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 @@ { _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 @@ { 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 @@ { __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 @@ __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 @@ 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 @@ } 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 @@ __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 @@ // 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 @@ 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 @@ __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 @@ // 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 @@ __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 @@ 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 @@ 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 @@ __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 @@ // 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 @@ 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 @@ __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 @@ __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 @@ 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 @@ 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 @@ // 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 @@ // 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 @@ __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 @@ 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 --- a/libcxx/include/__iterator/common_iterator.h +++ b/libcxx/include/__iterator/common_iterator.h @@ -101,14 +101,14 @@ 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 @@ 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 @@ } 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 @@ 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 @@ _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 --- a/libcxx/include/__iterator/iter_move.h +++ b/libcxx/include/__iterator/iter_move.h @@ -36,6 +36,7 @@ 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)); }; @@ -59,6 +60,7 @@ // [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 @@ -66,6 +68,7 @@ { 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 --- a/libcxx/include/__iterator/iter_swap.h +++ b/libcxx/include/__iterator/iter_swap.h @@ -40,6 +40,7 @@ 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)); }; @@ -48,7 +49,9 @@ 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 @@ -57,6 +60,7 @@ { (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 --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -843,7 +843,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ _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 @@ _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 --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -382,7 +382,7 @@ 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 @@ -1810,7 +1810,7 @@ _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(); @@ -1823,7 +1823,7 @@ 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> @@ -1831,7 +1831,7 @@ _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(); @@ -1843,7 +1843,7 @@ 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> @@ -1851,7 +1851,7 @@ _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(); @@ -1864,7 +1864,7 @@ 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> @@ -1873,7 +1873,7 @@ 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)) { @@ -1894,7 +1894,7 @@ 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> @@ -1904,7 +1904,7 @@ 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> @@ -1914,7 +1914,7 @@ 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 --- a/libcxx/include/__memory/uninitialized_algorithms.h +++ b/libcxx/include/__memory/uninitialized_algorithms.h @@ -284,7 +284,7 @@ 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 --- a/libcxx/include/__numeric/midpoint.h +++ b/libcxx/include/__numeric/midpoint.h @@ -69,10 +69,10 @@ { 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 --- a/libcxx/include/__random/binomial_distribution.h +++ b/libcxx/include/__random/binomial_distribution.h @@ -133,9 +133,9 @@ 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 --- a/libcxx/include/__random/uniform_int_distribution.h +++ b/libcxx/include/__random/uniform_int_distribution.h @@ -242,7 +242,7 @@ 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 --- a/libcxx/include/__split_buffer +++ b/libcxx/include/__split_buffer @@ -500,7 +500,7 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 --- a/libcxx/include/__string/char_traits.h +++ b/libcxx/include/__string/char_traits.h @@ -671,7 +671,7 @@ 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 --- a/libcxx/include/__type_traits/conjunction.h +++ b/libcxx/include/__type_traits/conjunction.h @@ -35,7 +35,7 @@ // 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 --- a/libcxx/include/__type_traits/is_callable.h +++ b/libcxx/include/__type_traits/is_callable.h @@ -25,7 +25,7 @@ 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 --- a/libcxx/include/__type_traits/is_implicitly_default_constructible.h +++ b/libcxx/include/__type_traits/is_implicitly_default_constructible.h @@ -33,12 +33,12 @@ { }; 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 --- a/libcxx/include/__type_traits/is_valid_expansion.h +++ b/libcxx/include/__type_traits/is_valid_expansion.h @@ -24,7 +24,7 @@ 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 --- a/libcxx/include/__utility/declval.h +++ b/libcxx/include/__utility/declval.h @@ -27,7 +27,7 @@ _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 --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -1452,10 +1452,10 @@ { 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_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 @@ 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_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 @@ _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 @@ _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 @@ _Tp* fetch_add(ptrdiff_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(ptrdiff_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(ptrdiff_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(ptrdiff_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 @@ 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 @@ 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 --- a/libcxx/include/barrier +++ b/libcxx/include/barrier @@ -125,7 +125,7 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY __barrier_base(ptrdiff_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 @@ 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 --- a/libcxx/include/charconv +++ b/libcxx/include/charconv @@ -231,7 +231,7 @@ 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 @@ __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 @@ 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 @@ } #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 @@ 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); } ptrdiff_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 @@ __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 @@ 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 @@ { 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 @@ }; 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 @@ { for (; __r.ptr != __last; ++__r.ptr) { - if (!__in_pattern(*__r.ptr, __args...)) + if (!std::__in_pattern(*__r.ptr, __args...)) break; } } @@ -679,13 +687,13 @@ 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 @@ 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 @@ 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 @@ __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 @@ 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 --- a/libcxx/include/cmath +++ b/libcxx/include/cmath @@ -558,7 +558,7 @@ 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 @@ -579,7 +579,7 @@ _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> @@ -599,7 +599,7 @@ _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> @@ -619,7 +619,7 @@ _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 @@ -661,7 +661,7 @@ 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 --- a/libcxx/include/complex +++ b/libcxx/include/complex @@ -596,40 +596,40 @@ _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 @@ _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 @@ _Tp abs(const complex<_Tp>& __c) { - return hypot(__c.real(), __c.imag()); + return std::hypot(__c.real(), __c.imag()); } // arg @@ -863,7 +863,7 @@ _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 @@ >::type arg(_Tp __re) { - return atan2l(0.L, __re); + return std::atan2l(0.L, __re); } template<class _Tp> @@ -886,7 +886,7 @@ >::type arg(_Tp __re) { - return atan2(0., __re); + return std::atan2(0., __re); } template <class _Tp> @@ -897,7 +897,7 @@ >::type arg(_Tp __re) { - return atan2f(0.F, __re); + return std::atan2f(0.F, __re); } // norm @@ -907,10 +907,10 @@ _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 @@ 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 @@ >::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 @@ _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 @@ 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 @@ 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 @@ _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 @@ { _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 @@ 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 @@ 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 @@ 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 @@ 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 @@ _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 @@ _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 @@ _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 @@ _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 @@ 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 @@ _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 @@ _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 @@ 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,7 +1369,7 @@ _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()); } @@ -1379,7 +1379,7 @@ { if (__is.good()) { - ws(__is); + std::ws(__is); if (__is.peek() == _CharT('(')) { __is.get(); @@ -1387,7 +1387,7 @@ __is >> __r; if (!__is.fail()) { - ws(__is); + std::ws(__is); _CharT __c = __is.peek(); if (__c == _CharT(',')) { @@ -1396,7 +1396,7 @@ __is >> __i; if (!__is.fail()) { - ws(__is); + std::ws(__is); __c = __is.peek(); if (__c == _CharT(')')) { diff --git a/libcxx/include/deque b/libcxx/include/deque --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -2315,7 +2315,7 @@ 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 @@ { 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 @@ 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 @@ { 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 --- a/libcxx/include/experimental/functional +++ b/libcxx/include/experimental/functional @@ -205,8 +205,8 @@ _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<difference_type>>(__pattern_length_ + 1)} + __skip_{std::make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)}, + __suffix_{std::make_shared<vector<difference_type>>(__pattern_length_ + 1)} { // build the skip table for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i ) @@ -223,12 +223,12 @@ 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 @@ __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 @@ __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 @@ 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 @@ __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 --- a/libcxx/include/experimental/simd +++ b/libcxx/include/experimental/simd @@ -925,7 +925,7 @@ 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 @@ 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 @@ 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 @@ 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 --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -313,9 +313,9 @@ __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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -684,7 +684,7 @@ 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_)); } @@ -695,7 +695,7 @@ 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_); } @@ -755,7 +755,7 @@ 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 --- a/libcxx/include/iomanip +++ b/libcxx/include/iomanip @@ -311,7 +311,7 @@ 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 @@ { 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 @@ 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 @@ { 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 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -766,7 +766,7 @@ 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 @@ _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 --- a/libcxx/include/istream +++ b/libcxx/include/istream @@ -316,7 +316,7 @@ 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 @@ #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 @@ 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 @@ { #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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { #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 --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -446,8 +446,8 @@ __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 +459,8 @@ _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 +494,7 @@ } return 0; } - ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms; + ptrdiff_t __f = std::find(__atoms, __atoms + 26, __ct) - __atoms; if (__f >= 24) return -1; switch (__base) @@ -547,7 +547,7 @@ } return 0; } - ptrdiff_t __f = find(__atoms, __atoms + 32, __ct) - __atoms; + ptrdiff_t __f = std::find(__atoms, __atoms + 32, __ct) - __atoms; if (__f >= 32) return -1; char __x = __src[__f]; @@ -849,7 +849,7 @@ __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 +892,8 @@ } 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 +950,7 @@ 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 +1007,7 @@ 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 +1062,7 @@ 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 +1084,8 @@ 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 +1152,8 @@ _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 +1172,7 @@ *__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 +1189,7 @@ *__oe++ = __ct.widen(*__p); ++__dc; } - reverse(__ob + (__nf - __nb), __oe); + std::reverse(__ob + (__nf - __nb), __oe); } if (__np == __ne) __op = __oe; @@ -1203,8 +1203,8 @@ _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 +1233,7 @@ } else { - reverse(__nf, __ns); + std::reverse(__nf, __ns); _CharT __thousands_sep = __npt.thousands_sep(); unsigned __dc = 0; unsigned __dg = 0; @@ -1249,7 +1249,7 @@ *__oe++ = __ct.widen(*__p); ++__dc; } - reverse(__ob + (__nf - __nb), __oe); + std::reverse(__ob + (__nf - __nb), __oe); } for (__nf = __ns; __nf < __ne; ++__nf) { @@ -1459,7 +1459,7 @@ { 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()); @@ -1494,7 +1494,7 @@ _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") - int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); + int __nc = std::__libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); _LIBCPP_DIAGNOSTIC_POP char* __ne = __nar + __nc; char* __np = this->__identify_padding(__nar, __ne, __iob); @@ -1505,7 +1505,7 @@ 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> @@ -1559,17 +1559,17 @@ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") if (__specify_precision) - __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, + __nc = std::__libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); else - __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v); + __nc = std::__libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v); unique_ptr<char, void(*)(void*)> __nbh(nullptr, free); if (__nc > static_cast<int>(__nbuf-1)) { if (__specify_precision) - __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); + __nc = std::__libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); else - __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); + __nc = std::__libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); if (__nc == -1) __throw_bad_alloc(); __nbh.reset(__nb); @@ -1593,7 +1593,7 @@ 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 +1628,7 @@ 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 +1637,7 @@ __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 +1923,7 @@ 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 +1937,7 @@ 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 +1955,7 @@ 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 +1967,7 @@ 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 +1981,7 @@ 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 +1995,7 @@ 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 +2009,7 @@ 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 +2023,7 @@ 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 +2037,7 @@ 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 +2102,7 @@ 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 +2189,7 @@ 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 +2201,7 @@ 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 +2213,7 @@ 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 +2226,7 @@ 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 +2504,7 @@ 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 +2732,7 @@ 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 +2745,7 @@ 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 +2829,7 @@ 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 +2944,7 @@ ++__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 +2975,14 @@ 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 +2992,7 @@ 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 +3010,7 @@ return false; } if (__wn == __we) - __double_or_nothing(__wb, __wn, __we); + std::__double_or_nothing(__wb, __wn, __we); *__wn++ = *__b; } } @@ -3060,7 +3060,7 @@ 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 +3081,7 @@ 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 +3104,7 @@ 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 +3166,7 @@ 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 +3186,7 @@ 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 +3286,7 @@ } } // reverse it - reverse(__t, __me); + std::reverse(__t, __me); } break; } @@ -3378,7 +3378,7 @@ } // 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 +3410,7 @@ 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 +3421,7 @@ { // 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 +3452,7 @@ 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 +3539,7 @@ { #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 +3547,7 @@ 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 +3994,7 @@ 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 +4265,7 @@ { 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; diff --git a/libcxx/include/mutex b/libcxx/include/mutex --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -352,7 +352,7 @@ 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 @@ 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 @@ 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 @@ __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 @@ 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 @@ 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 --- a/libcxx/include/new +++ b/libcxx/include/new @@ -295,9 +295,9 @@ 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 --- a/libcxx/include/ostream +++ b/libcxx/include/ostream @@ -412,7 +412,7 @@ 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 @@ { 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 @@ 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 @@ { 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { _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 @@ } 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 @@ 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 --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -1157,8 +1157,8 @@ 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 @@ 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 @@ { 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 @@ } 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 @@ __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 @@ 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 @@ __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 @@ 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 @@ 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_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_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_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_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 --- a/libcxx/include/scoped_allocator +++ b/libcxx/include/scoped_allocator @@ -373,7 +373,7 @@ 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 --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -113,7 +113,7 @@ 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 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -3480,7 +3480,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { 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 --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -493,14 +493,14 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { _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 --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -199,7 +199,7 @@ { _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 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -1397,7 +1397,7 @@ 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 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -1149,7 +1149,7 @@ #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 @@ #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 --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -613,7 +613,7 @@ #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 @@ #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 --- a/libcxx/include/valarray +++ b/libcxx/include/valarray @@ -545,7 +545,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return abs(__x);} + {return std::abs(__x);} }; template <class _Tp> @@ -554,7 +554,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return acos(__x);} + {return std::acos(__x);} }; template <class _Tp> @@ -563,7 +563,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return asin(__x);} + {return std::asin(__x);} }; template <class _Tp> @@ -572,7 +572,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return atan(__x);} + {return std::atan(__x);} }; template <class _Tp> @@ -581,7 +581,7 @@ 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> @@ -590,7 +590,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return cos(__x);} + {return std::cos(__x);} }; template <class _Tp> @@ -599,7 +599,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return cosh(__x);} + {return std::cosh(__x);} }; template <class _Tp> @@ -608,7 +608,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return exp(__x);} + {return std::exp(__x);} }; template <class _Tp> @@ -617,7 +617,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return log(__x);} + {return std::log(__x);} }; template <class _Tp> @@ -626,7 +626,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return log10(__x);} + {return std::log10(__x);} }; template <class _Tp> @@ -635,7 +635,7 @@ 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> @@ -644,7 +644,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return sin(__x);} + {return std::sin(__x);} }; template <class _Tp> @@ -653,7 +653,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return sinh(__x);} + {return std::sinh(__x);} }; template <class _Tp> @@ -662,7 +662,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return sqrt(__x);} + {return std::sqrt(__x);} }; template <class _Tp> @@ -671,7 +671,7 @@ typedef _Tp __result_type; _LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const - {return tan(__x);} + {return std::tan(__x);} }; template <class _Tp> @@ -680,7 +680,7 @@ 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 --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -436,24 +436,24 @@ 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 @@ 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_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 @@ 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 @@ 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 @@ 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 @@ 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 @@ _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 @@ 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 @@ 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 @@ 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 @@ 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 --- 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 --- a/libcxx/test/configs/cmake-bridge.cfg.in +++ b/libcxx/test/configs/cmake-bridge.cfg.in @@ -30,3 +30,4 @@ 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 --- 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 --- /dev/null +++ b/libcxx/test/tools/CMakeLists.txt @@ -0,0 +1,6 @@ + +set(LIBCXX_TEST_TOOLS_PATH ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) + +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 --- /dev/null +++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt @@ -0,0 +1,44 @@ + +# Look for the latest package +SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL) +SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC) + +# TODO LLVM16 check for Clang version and remove LIBCXX_ENABLE_CLANG_TIDY +find_package(Clang) + +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} + ${LLVM_MAIN_INCLUDE_DIR}/../../clang-tools-extra + ) +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 --- /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.hpp b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.hpp new file mode 100644 --- /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/test/tools/clang_tidy_checks/robust_against_adl.cpp b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp new file mode 100644 --- /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/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -94,6 +94,7 @@ generate-cmake-base \ -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \ -DLIBCXX_CXX_ABI=libcxxabi \ + -DLIBCXX_ENABLE_CLANG_TIDY=ON \ "${@}" } diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- 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