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 _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(__libcpp_ctz(__mask_)));} + {return __bit_iterator<_Cp, false>(__seg_, static_cast(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(*__seg_ & __mask_);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, true> operator&() const _NOEXCEPT - {return __bit_iterator<_Cp, true>(__seg_, static_cast(__libcpp_ctz(__mask_)));} + {return __bit_iterator<_Cp, true>(__seg_, static_cast(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 (abs(__d))), - __m_(duration_cast(abs(__d) - hours())), - __s_(duration_cast(abs(__d) - hours() - minutes())), - __f_(duration_cast (abs(__d) - hours() - minutes() - seconds())) + __h_(chrono::duration_cast (chrono::abs(__d))), + __m_(chrono::duration_cast(chrono::abs(__d) - hours())), + __s_(chrono::duration_cast(chrono::abs(__d) - hours() - minutes())), + __f_(chrono::duration_cast (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 @@ -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 @@ -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 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 requires is_same_v, 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 requires is_same_v, 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 requires is_same_v, 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> 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 requires is_same_v, 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> 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(__arg.__type_) << __shift; else @@ -212,7 +212,7 @@ template _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 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 @@ -304,7 +304,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 _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>(__loc); + const auto& __np = std::use_facet>(__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>(__ctx.locale()); + const auto& __np = std::use_facet>(__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>(__ctx.locale()); + const auto& __np = std::use_facet>(__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 _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 _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 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 @@ -875,7 +875,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; @@ -883,12 +883,12 @@ return {__str.size(), __str.end()}; if (__maximum == 0) { - if (__is_ascii(*__it)) + if (__format_spec::__is_ascii(*__it)) return {static_cast(__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(__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(__s); - const uint32_t __b = __loadword(__s + __len - 4); + const uint32_t __a = std::__loadword(__s); + const uint32_t __b = std::__loadword(__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(__n); } _LIBCPP_INLINE_VISIBILITY void __reserve_unique(size_type __n) { - __rehash_unique(static_cast(ceil(__n / max_load_factor()))); + __rehash_unique(static_cast(std::ceil(__n / max_load_factor()))); } _LIBCPP_INLINE_VISIBILITY void __reserve_multi(size_type __n) { - __rehash_multi(static_cast(ceil(__n / max_load_factor()))); + __rehash_multi(static_cast(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 @@ -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(2 * __bc + !__is_hash_power2(__bc), - size_type(ceil(float(size() + 1) / max_load_factor())))); + __rehash_unique(_VSTD::max(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(2 * __bc + !__is_hash_power2(__bc), - size_type(ceil(float(size() + 1) / max_load_factor())))); + __rehash_multi(_VSTD::max(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(2 * __bc + !__is_hash_power2(__bc), - size_type(ceil(float(size() + 1) / max_load_factor())))); + __rehash_multi(_VSTD::max(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(2 * __bc + !__is_hash_power2(__bc), - size_type(ceil(float(size() + 1) / max_load_factor())))); + __rehash_unique(_VSTD::max(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 ( __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 { - _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> || constructible_from, 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>) { @@ -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()))) 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(), declval()))) { - _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> && 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 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 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> || __class_or_enum>) && 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<_T2>>; + struct __fn { + // NOLINTBEGIN(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap template 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 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 >(__loc).is(ctype_base::space, __c); + return std::use_facet >(__loc).is(ctype_base::space, __c); } template @@ -851,7 +851,7 @@ bool isprint(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::print, __c); + return std::use_facet >(__loc).is(ctype_base::print, __c); } template @@ -859,7 +859,7 @@ bool iscntrl(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::cntrl, __c); + return std::use_facet >(__loc).is(ctype_base::cntrl, __c); } template @@ -867,7 +867,7 @@ bool isupper(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::upper, __c); + return std::use_facet >(__loc).is(ctype_base::upper, __c); } template @@ -875,7 +875,7 @@ bool islower(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::lower, __c); + return std::use_facet >(__loc).is(ctype_base::lower, __c); } template @@ -883,7 +883,7 @@ bool isalpha(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::alpha, __c); + return std::use_facet >(__loc).is(ctype_base::alpha, __c); } template @@ -891,7 +891,7 @@ bool isdigit(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::digit, __c); + return std::use_facet >(__loc).is(ctype_base::digit, __c); } template @@ -899,7 +899,7 @@ bool ispunct(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::punct, __c); + return std::use_facet >(__loc).is(ctype_base::punct, __c); } template @@ -907,7 +907,7 @@ bool isxdigit(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::xdigit, __c); + return std::use_facet >(__loc).is(ctype_base::xdigit, __c); } template @@ -915,7 +915,7 @@ bool isalnum(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::alnum, __c); + return std::use_facet >(__loc).is(ctype_base::alnum, __c); } template @@ -923,7 +923,7 @@ bool isgraph(_CharT __c, const locale& __loc) { - return use_facet >(__loc).is(ctype_base::graph, __c); + return std::use_facet >(__loc).is(ctype_base::graph, __c); } template @@ -931,7 +931,7 @@ _CharT toupper(_CharT __c, const locale& __loc) { - return use_facet >(__loc).toupper(__c); + return std::use_facet >(__loc).toupper(__c); } template @@ -939,7 +939,7 @@ _CharT tolower(_CharT __c, const locale& __loc) { - return use_facet >(__loc).tolower(__c); + return std::use_facet >(__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 -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 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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((__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(_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(2 * static_cast(__end_cap() - __first_), 1); + size_type __c = std::max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, (__c + 3) / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__end_)); @@ -530,7 +530,7 @@ } else { - size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); + size_type __c = std::max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, (__c + 3) / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__end_)); @@ -562,7 +562,7 @@ } else { - size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); + size_type __c = std::max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__end_)); @@ -592,7 +592,7 @@ } else { - size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); + size_type __c = std::max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__end_)); @@ -624,7 +624,7 @@ } else { - size_type __c = max(2 * static_cast(__end_cap() - __first_), 1); + size_type __c = std::max(2 * static_cast(__end_cap() - __first_), 1); __split_buffer __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator(__begin_), move_iterator(__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 -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 -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 -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 -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