[libc++] Enable radability-identifier-naming for local variables and fix any problems
authorNikolas Klauser <nikolasklauser@berlin.de>
Fri, 10 Feb 2023 15:25:40 +0000 (16:25 +0100)
committerNikolas Klauser <nikolasklauser@berlin.de>
Sat, 11 Feb 2023 19:03:53 +0000 (20:03 +0100)
Fixes #60658

Reviewed By: Mordante, #libc

Spies: aheejin, sstefan1, libcxx-commits

Differential Revision: https://reviews.llvm.org/D143737

29 files changed:
libcxx/.clang-tidy
libcxx/include/__algorithm/sort.h
libcxx/include/__bit/bit_ceil.h
libcxx/include/__chrono/duration.h
libcxx/include/__compare/common_comparison_category.h
libcxx/include/__functional/bind.h
libcxx/include/__functional/function.h
libcxx/include/__iterator/advance.h
libcxx/include/__random/clamp_to_integral.h
libcxx/include/__random/generate_canonical.h
libcxx/include/__random/independent_bits_engine.h
libcxx/include/__random/mersenne_twister_engine.h
libcxx/include/__random/normal_distribution.h
libcxx/include/__random/piecewise_linear_distribution.h
libcxx/include/__random/poisson_distribution.h
libcxx/include/__random/shuffle_order_engine.h
libcxx/include/__random/uniform_int_distribution.h
libcxx/include/__ranges/drop_view.h
libcxx/include/__ranges/elements_view.h
libcxx/include/__ranges/filter_view.h
libcxx/include/__threading_support
libcxx/include/bitset
libcxx/include/future
libcxx/include/mutex
libcxx/include/regex
libcxx/include/semaphore
libcxx/include/shared_mutex
libcxx/include/thread
libcxx/include/variant

index 4bc25c3..8f7cef9 100644 (file)
@@ -46,6 +46,10 @@ CheckOptions:
     value: __
   - key:   readability-identifier-naming.PrivateMemberSuffix
     value: _
+  - key:   readability-identifier-naming.LocalVariableCase
+    value: lower_case
+  - key:   readability-identifier-naming.LocalVariablePrefix
+    value: __
 
 # TODO: investigate these checks
 # bugprone-branch-clone,
index a0e56e2..fcdeda3 100644 (file)
@@ -400,11 +400,11 @@ inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos(
   // Swap one pair on each iteration as long as both bitsets have at least one
   // element for swapping.
   while (__left_bitset != 0 && __right_bitset != 0) {
-    difference_type tz_left  = __libcpp_ctz(__left_bitset);
-    __left_bitset            = __libcpp_blsr(__left_bitset);
-    difference_type tz_right = __libcpp_ctz(__right_bitset);
-    __right_bitset           = __libcpp_blsr(__right_bitset);
-    _Ops::iter_swap(__first + tz_left, __last - tz_right);
+    difference_type __tz_left  = __libcpp_ctz(__left_bitset);
+    __left_bitset              = __libcpp_blsr(__left_bitset);
+    difference_type __tz_right = __libcpp_ctz(__right_bitset);
+    __right_bitset             = __libcpp_blsr(__right_bitset);
+    _Ops::iter_swap(__first + __tz_left, __last - __tz_right);
   }
 }
 
@@ -469,9 +469,9 @@ inline _LIBCPP_HIDE_FROM_ABI void __bitset_partition_partial_blocks(
   // Record the comparison outcomes for the elements currently on the left side.
   if (__left_bitset == 0) {
     _RandomAccessIterator __iter = __first;
-    for (int j = 0; j < __l_size; j++) {
+    for (int __j = 0; __j < __l_size; __j++) {
       bool __comp_result = !__comp(*__iter, __pivot);
-      __left_bitset |= (static_cast<uint64_t>(__comp_result) << j);
+      __left_bitset |= (static_cast<uint64_t>(__comp_result) << __j);
       ++__iter;
     }
   }
@@ -479,9 +479,9 @@ inline _LIBCPP_HIDE_FROM_ABI void __bitset_partition_partial_blocks(
   // side.
   if (__right_bitset == 0) {
     _RandomAccessIterator __iter = __lm1;
-    for (int j = 0; j < __r_size; j++) {
+    for (int __j = 0; __j < __r_size; __j++) {
       bool __comp_result = __comp(*__iter, __pivot);
-      __right_bitset |= (static_cast<uint64_t>(__comp_result) << j);
+      __right_bitset |= (static_cast<uint64_t>(__comp_result) << __j);
       --__iter;
     }
   }
@@ -501,9 +501,9 @@ inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos_within(
     while (__left_bitset != 0) {
       difference_type __tz_left = __detail::__block_size - 1 - __libcpp_clz(__left_bitset);
       __left_bitset &= (static_cast<uint64_t>(1) << __tz_left) - 1;
-      _RandomAccessIterator it = __first + __tz_left;
-      if (it != __lm1) {
-        _Ops::iter_swap(it, __lm1);
+      _RandomAccessIterator __it = __first + __tz_left;
+      if (__it != __lm1) {
+        _Ops::iter_swap(__it, __lm1);
       }
       --__lm1;
     }
@@ -514,9 +514,9 @@ inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos_within(
     while (__right_bitset != 0) {
       difference_type __tz_right = __detail::__block_size - 1 - __libcpp_clz(__right_bitset);
       __right_bitset &= (static_cast<uint64_t>(1) << __tz_right) - 1;
-      _RandomAccessIterator it = __lm1 - __tz_right;
-      if (it != __first) {
-        _Ops::iter_swap(it, __first);
+      _RandomAccessIterator __it = __lm1 - __tz_right;
+      if (__it != __first) {
+        _Ops::iter_swap(__it, __first);
       }
       ++__first;
     }
index a558d61..1332900 100644 (file)
@@ -34,8 +34,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_ceil(_Tp __t) noexcept {
     return _Tp{1} << __n;
   else {
     const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits;
-    const unsigned __retVal = 1u << (__n + __extra);
-    return (_Tp)(__retVal >> __extra);
+    const unsigned __ret_val = 1u << (__n + __extra);
+    return (_Tp)(__ret_val >> __extra);
   }
 }
 
index afcc38b..af0e7d3 100644 (file)
@@ -186,11 +186,11 @@ round(const duration<_Rep, _Period>& __d)
 {
     _ToDuration __lower = chrono::floor<_ToDuration>(__d);
     _ToDuration __upper = __lower + _ToDuration{1};
-    auto __lowerDiff = __d - __lower;
-    auto __upperDiff = __upper - __d;
-    if (__lowerDiff < __upperDiff)
+    auto __lower_diff   = __d - __lower;
+    auto __upper_diff   = __upper - __d;
+    if (__lower_diff < __upper_diff)
         return __lower;
-    if (__lowerDiff > __upperDiff)
+    if (__lower_diff > __upper_diff)
         return __upper;
     return __lower.count() & 1 ? __upper : __lower;
 }
index 06c4b28..cd28d2c 100644 (file)
@@ -65,14 +65,14 @@ _LIBCPP_HIDE_FROM_ABI
 constexpr auto __get_comp_type() {
   using _CCC = _ClassifyCompCategory;
   constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...};
-  constexpr _CCC _Cat = __comp_detail::__compute_comp_type(__type_kinds);
-  if constexpr (_Cat == _None)
+  constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds);
+  if constexpr (__cat == _None)
     return void();
-  else if constexpr (_Cat == _PartialOrd)
+  else if constexpr (__cat == _PartialOrd)
     return partial_ordering::equivalent;
-  else if constexpr (_Cat == _WeakOrd)
+  else if constexpr (__cat == _WeakOrd)
     return weak_ordering::equivalent;
-  else if constexpr (_Cat == _StrongOrd)
+  else if constexpr (__cat == _StrongOrd)
     return strong_ordering::equivalent;
   else
     static_assert(_False, "unhandled case");
index 297e4e5..0a70456 100644 (file)
@@ -132,8 +132,8 @@ typename enable_if
 >::type
 __mu(_Ti&, _Uj& __uj)
 {
-    const size_t _Indx = is_placeholder<_Ti>::value - 1;
-    return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj));
+    const size_t __indx = is_placeholder<_Ti>::value - 1;
+    return _VSTD::forward<typename tuple_element<__indx, _Uj>::type>(_VSTD::get<__indx>(__uj));
 }
 
 template <class _Ti, class _Uj>
index 9f92f61..f8023df 100644 (file)
@@ -614,15 +614,15 @@ struct __policy
     _LIBCPP_INLINE_VISIBILITY
     static const __policy* __create_empty()
     {
-        static const _LIBCPP_CONSTEXPR __policy __policy_ = {nullptr, nullptr,
-                                                             true,
+        static const _LIBCPP_CONSTEXPR __policy __policy = {nullptr, nullptr,
+                                                            true,
 #ifndef _LIBCPP_HAS_NO_RTTI
-                                                             &typeid(void)
+                                                            &typeid(void)
 #else
-                                                             nullptr
+                                                            nullptr
 #endif
         };
-        return &__policy_;
+        return &__policy;
     }
 
   private:
@@ -640,7 +640,7 @@ struct __policy
     template <typename _Fun>
     _LIBCPP_INLINE_VISIBILITY static const __policy*
     __choose_policy(/* is_small = */ false_type) {
-      static const _LIBCPP_CONSTEXPR __policy __policy_ = {
+      static const _LIBCPP_CONSTEXPR __policy __policy = {
           &__large_clone<_Fun>, &__large_destroy<_Fun>, false,
 #ifndef _LIBCPP_HAS_NO_RTTI
           &typeid(typename _Fun::_Target)
@@ -648,14 +648,14 @@ struct __policy
           nullptr
 #endif
       };
-        return &__policy_;
+        return &__policy;
     }
 
     template <typename _Fun>
     _LIBCPP_INLINE_VISIBILITY static const __policy*
         __choose_policy(/* is_small = */ true_type)
     {
-        static const _LIBCPP_CONSTEXPR __policy __policy_ = {
+        static const _LIBCPP_CONSTEXPR __policy __policy = {
             nullptr, nullptr, false,
 #ifndef _LIBCPP_HAS_NO_RTTI
             &typeid(typename _Fun::_Target)
@@ -663,7 +663,7 @@ struct __policy
             nullptr
 #endif
         };
-        return &__policy_;
+        return &__policy;
     }
 };
 
index 154c273..8ccbe6f 100644 (file)
@@ -159,9 +159,9 @@ public:
                __a > 0  ? __a >= __b :
                           __a <= __b;
       };
-      if (const auto __M = __bound_sentinel - __i; __magnitude_geq(__n, __M)) {
+      if (const auto __m = __bound_sentinel - __i; __magnitude_geq(__n, __m)) {
         (*this)(__i, __bound_sentinel);
-        return __n - __M;
+        return __n - __m;
       }
 
       // Otherwise, equivalent to `ranges::advance(i, n)`.
index 7d44ff9..85f8aa5 100644 (file)
@@ -44,8 +44,8 @@ template <class _IntT, class _RealT>
 _LIBCPP_INLINE_VISIBILITY
 _IntT __clamp_to_integral(_RealT __r) _NOEXCEPT {
   using _Lim = numeric_limits<_IntT>;
-  const _IntT _MaxVal = __max_representable_int_for_float<_IntT, _RealT>();
-  if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) {
+  const _IntT __max_val = __max_representable_int_for_float<_IntT, _RealT>();
+  if (__r >= ::nextafter(static_cast<_RealT>(__max_val), INFINITY)) {
     return _Lim::max();
   } else if (__r <= _Lim::lowest()) {
     return _Lim::min();
index 5fada6d..5f0aa6f 100644 (file)
@@ -30,20 +30,20 @@ template<class _RealType, size_t __bits, class _URNG>
 _LIBCPP_HIDE_FROM_ABI _RealType
 generate_canonical(_URNG& __g)
 {
-    const size_t _Dt = numeric_limits<_RealType>::digits;
-    const size_t __b = _Dt < __bits ? _Dt : __bits;
+    const size_t __dt = numeric_limits<_RealType>::digits;
+    const size_t __b = __dt < __bits ? __dt : __bits;
 #ifdef _LIBCPP_CXX03_LANG
-    const size_t __logR = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value;
+    const size_t __log_r = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value;
 #else
-    const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
+    const size_t __log_r = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
 #endif
-    const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0);
-    const _RealType _Rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1);
-    _RealType __base = _Rp;
-    _RealType _Sp = __g() - _URNG::min();
-    for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp)
-        _Sp += (__g() - _URNG::min()) * __base;
-    return _Sp / __base;
+    const size_t __k = __b / __log_r + (__b % __log_r != 0) + (__b == 0);
+    const _RealType __rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1);
+    _RealType __base = __rp;
+    _RealType __sp = __g() - _URNG::min();
+    for (size_t __i = 1; __i < __k; ++__i, __base *= __rp)
+        __sp += (__g() - _URNG::min()) * __base;
+    return __sp / __base;
 }
 
 _LIBCPP_END_NAMESPACE_STD
index 151492a..f4a23bb 100644 (file)
@@ -196,7 +196,7 @@ template<class _Engine, size_t __w, class _UIntType>
 _UIntType
 independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
 {
-    result_type _Sp = 0;
+    result_type __sp = 0;
     for (size_t __k = 0; __k < __n0; ++__k)
     {
         _Engine_result_type __u;
@@ -204,7 +204,7 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
         {
             __u = __e_() - _Engine::min();
         } while (__u >= __y0);
-        _Sp = static_cast<result_type>(__lshift<__w0>(_Sp) + (__u & __mask0));
+        __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0));
     }
     for (size_t __k = __n0; __k < __n; ++__k)
     {
@@ -213,9 +213,9 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
         {
             __u = __e_() - _Engine::min();
         } while (__u >= __y1);
-        _Sp = static_cast<result_type>(__lshift<__w0+1>(_Sp) + (__u & __mask1));
+        __sp = static_cast<result_type>(__lshift<__w0+1>(__sp) + (__u & __mask1));
     }
-    return _Sp;
+    return __sp;
 }
 
 template<class _Eng, size_t _Wp, class _UInt>
index 3a58e31..eb5f56f 100644 (file)
@@ -403,9 +403,9 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
     const size_t __j = (__i_ + 1) % __n;
     const result_type __mask = __r == _Dt ? result_type(~0) :
                                        (result_type(1) << __r) - result_type(1);
-    const result_type _Yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
+    const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
     const size_t __k = (__i_ + __m) % __n;
-    __x_[__i_] = __x_[__k] ^ __rshift<1>(_Yp) ^ (__a * (_Yp & 1));
+    __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1));
     result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d);
     __i_ = __j;
     __z ^= __lshift<__s>(__z) & __b;
index b2ed47e..93f3d1f 100644 (file)
@@ -133,30 +133,30 @@ _RealType
 normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
 {
     static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
-    result_type _Up;
+    result_type __up;
     if (__v_hot_)
     {
         __v_hot_ = false;
-        _Up = __v_;
+        __up = __v_;
     }
     else
     {
-        uniform_real_distribution<result_type> _Uni(-1, 1);
+        uniform_real_distribution<result_type> __uni(-1, 1);
         result_type __u;
         result_type __v;
         result_type __s;
         do
         {
-            __u = _Uni(__g);
-            __v = _Uni(__g);
+            __u = __uni(__g);
+            __v = __uni(__g);
             __s = __u * __u + __v * __v;
         } while (__s > 1 || __s == 0);
-        result_type _Fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s);
-        __v_ = __v * _Fp;
+        result_type __fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s);
+        __v_ = __v * __fp;
         __v_hot_ = true;
-        _Up = __u * _Fp;
+        __up = __u * __fp;
     }
-    return _Up * __p.stddev() + __p.mean();
+    return __up * __p.stddev() + __p.mean();
 }
 
 template <class _CharT, class _Traits, class _RT>
@@ -189,16 +189,16 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     __is.flags(_Istream::dec | _Istream::skipws);
     result_type __mean;
     result_type __stddev;
-    result_type _Vp = 0;
-    bool _V_hot = false;
-    __is >> __mean >> __stddev >> _V_hot;
-    if (_V_hot)
-        __is >> _Vp;
+    result_type __vp = 0;
+    bool __v_hot = false;
+    __is >> __mean >> __stddev >> __v_hot;
+    if (__v_hot)
+        __is >> __vp;
     if (!__is.fail())
     {
         __x.param(param_type(__mean, __stddev));
-        __x.__v_hot_ = _V_hot;
-        __x.__v_ = _Vp;
+        __x.__v_hot_ = __v_hot;
+        __x.__v_ = __vp;
     }
     return __is;
 }
index fc2eb47..0430b24 100644 (file)
@@ -188,23 +188,23 @@ void
 piecewise_linear_distribution<_RealType>::param_type::__init()
 {
     __areas_.assign(__densities_.size() - 1, result_type());
-    result_type _Sp = 0;
+    result_type __sp = 0;
     for (size_t __i = 0; __i < __areas_.size(); ++__i)
     {
         __areas_[__i] = (__densities_[__i+1] + __densities_[__i]) *
                         (__b_[__i+1] - __b_[__i]) * .5;
-        _Sp += __areas_[__i];
+        __sp += __areas_[__i];
     }
     for (size_t __i = __areas_.size(); __i > 1;)
     {
         --__i;
-        __areas_[__i] = __areas_[__i-1] / _Sp;
+        __areas_[__i] = __areas_[__i-1] / __sp;
     }
     __areas_[0] = 0;
     for (size_t __i = 1; __i < __areas_.size(); ++__i)
         __areas_[__i] += __areas_[__i-1];
     for (size_t __i = 0; __i < __densities_.size(); ++__i)
-        __densities_[__i] /= _Sp;
+        __densities_[__i] /= __sp;
 }
 
 template<class _RealType>
index 334c610..2b39937 100644 (file)
@@ -144,12 +144,12 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean)
         __d_ = 6 * __mean_ * __mean_;
         __l_ = _VSTD::trunc(__mean_ - 1.1484);
         __omega_ = .3989423 / __s_;
-        double __b1_ = .4166667E-1 / __mean_;
-        double __b2_ = .3 * __b1_ * __b1_;
-        __c3_ = .1428571 * __b1_ * __b2_;
-        __c2_ = __b2_ - 15. * __c3_;
-        __c1_ = __b1_ - 6. * __b2_ + 45. * __c3_;
-        __c0_ = 1. - __b1_ + 3. * __b2_ - 15. * __c3_;
+        double __b1 = .4166667E-1 / __mean_;
+        double __b2 = .3 * __b1 * __b1;
+        __c3_ = .1428571 * __b1 * __b2;
+        __c2_ = __b2 - 15. * __c3_;
+        __c1_ = __b1 - 6. * __b2 + 45. * __c3_;
+        __c0_ = 1. - __b1 + 3. * __b2 - 15. * __c3_;
         __c_ = .1069 / __mean_;
     }
 }
index 4a27289..86a60fc 100644 (file)
@@ -201,10 +201,10 @@ private:
         _LIBCPP_INLINE_VISIBILITY
         result_type __evalf()
         {
-            const double _Fp = __d == 0 ?
+            const double __fp = __d == 0 ?
                 __n / (2. * 0x8000000000000000ull) :
                 __n / (double)__d;
-            const size_t __j = static_cast<size_t>(_Fp * (__y_ - _Min));
+            const size_t __j = static_cast<size_t>(__fp * (__y_ - _Min));
             __y_ = __v_[__j];
             __v_[__j] = __e_();
             return __y_;
@@ -262,16 +262,16 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef basic_istream<_CharT, _Traits> _Istream;
     __is.flags(_Istream::dec | _Istream::skipws);
     _Eng __e;
-    result_type _Vp[_Kp+1];
+    result_type __vp[_Kp+1];
     __is >> __e;
     for (size_t __i = 0; __i < _Kp+1; ++__i)
-        __is >> _Vp[__i];
+        __is >> __vp[__i];
     if (!__is.fail())
     {
         __x.__e_ = __e;
         for (size_t __i = 0; __i < _Kp; ++__i)
-            __x.__v_[__i] = _Vp[__i];
-        __x.__y_ = _Vp[_Kp];
+            __x.__v_[__i] = __vp[__i];
+        __x.__y_ = __vp[_Kp];
     }
     return __is;
 }
index b7db8a3..d0e548d 100644 (file)
@@ -120,8 +120,8 @@ template<class _Engine, class _UIntType>
 _UIntType
 __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
 {
-    const size_t _WRt = numeric_limits<result_type>::digits;
-    result_type _Sp = 0;
+    const size_t __w_rt = numeric_limits<result_type>::digits;
+    result_type __sp = 0;
     for (size_t __k = 0; __k < __n0_; ++__k)
     {
         _Engine_result_type __u;
@@ -129,11 +129,11 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
         {
             __u = __e_() - _Engine::min();
         } while (__u >= __y0_);
-        if (__w0_ < _WRt)
-            _Sp <<= __w0_;
+        if (__w0_ < __w_rt)
+            __sp <<= __w0_;
         else
-            _Sp = 0;
-        _Sp += __u & __mask0_;
+            __sp = 0;
+        __sp += __u & __mask0_;
     }
     for (size_t __k = __n0_; __k < __n_; ++__k)
     {
@@ -142,13 +142,13 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
         {
             __u = __e_() - _Engine::min();
         } while (__u >= __y1_);
-        if (__w0_ < _WRt - 1)
-            _Sp <<= __w0_ + 1;
+        if (__w0_ < __w_rt - 1)
+            __sp <<= __w0_ + 1;
         else
-            _Sp = 0;
-        _Sp += __u & __mask1_;
+            __sp = 0;
+        __sp += __u & __mask1_;
     }
-    return _Sp;
+    return __sp;
 }
 
 template<class _IntType = int>
@@ -234,22 +234,22 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
     static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
     typedef __conditional_t<sizeof(result_type) <= sizeof(uint32_t), uint32_t, __make_unsigned_t<result_type> >
         _UIntType;
-    const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1);
-    if (_Rp == 1)
+    const _UIntType __rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1);
+    if (__rp == 1)
         return __p.a();
-    const size_t _Dt = numeric_limits<_UIntType>::digits;
+    const size_t __dt = numeric_limits<_UIntType>::digits;
     typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
-    if (_Rp == 0)
-        return static_cast<result_type>(_Eng(__g, _Dt)());
-    size_t __w = _Dt - std::__countl_zero(_Rp) - 1;
-    if ((_Rp & (numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0)
+    if (__rp == 0)
+        return static_cast<result_type>(_Eng(__g, __dt)());
+    size_t __w = __dt - std::__countl_zero(__rp) - 1;
+    if ((__rp & (numeric_limits<_UIntType>::max() >> (__dt - __w))) != 0)
         ++__w;
     _Eng __e(__g, __w);
     _UIntType __u;
     do
     {
         __u = __e();
-    } while (__u >= _Rp);
+    } while (__u >= __rp);
     return static_cast<result_type>(__u + __p.a());
 }
 
index 8f3564a..db7e7d2 100644 (file)
@@ -255,12 +255,12 @@ struct __fn {
     {
       // Introducing local variables avoids calculating `min` and `distance` twice (at the cost of diverging from the
       // expression used in the `noexcept` clause and the return statement).
-      auto dist = ranges::distance(__rng);
-      auto clamped = std::min<_Dist>(dist, std::forward<_Np>(__n));
+      auto __dist = ranges::distance(__rng);
+      auto __clamped = std::min<_Dist>(__dist, std::forward<_Np>(__n));
       return          _RawRange(
-                              ranges::begin(__rng) + clamped,
+                              ranges::begin(__rng) + __clamped,
                               ranges::end(__rng),
-                              std::__to_unsigned_like(dist - clamped)
+                              std::__to_unsigned_like(__dist - __clamped)
                               );}
 
   // [range.drop.overview]: the "otherwise" case.
index 997380e..a80382b 100644 (file)
@@ -224,9 +224,9 @@ public:
   _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
     requires forward_range<_Base>
   {
-    auto temp = *this;
+    auto __temp = *this;
     ++__current_;
-    return temp;
+    return __temp;
   }
 
   _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
@@ -239,9 +239,9 @@ public:
   _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
     requires bidirectional_range<_Base>
   {
-    auto temp = *this;
+    auto __temp = *this;
     --__current_;
-    return temp;
+    return __temp;
   }
 
   _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
index e14a9ab..92ffb22 100644 (file)
@@ -180,9 +180,9 @@ namespace ranges {
     }
     _LIBCPP_HIDE_FROM_ABI
     constexpr __iterator operator--(int) requires bidirectional_range<_View> {
-      auto tmp = *this;
+      auto __tmp = *this;
       --*this;
-      return tmp;
+      return __tmp;
     }
 
     _LIBCPP_HIDE_FROM_ABI
index dcf2763..f758aa8 100644 (file)
@@ -259,21 +259,21 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
 
 int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
 {
-  pthread_mutexattr_t attr;
-  int __ec = pthread_mutexattr_init(&attr);
+  pthread_mutexattr_t __attr;
+  int __ec = pthread_mutexattr_init(&__attr);
   if (__ec)
     return __ec;
-  __ec = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+  __ec = pthread_mutexattr_settype(&__attr, PTHREAD_MUTEX_RECURSIVE);
   if (__ec) {
-    pthread_mutexattr_destroy(&attr);
+    pthread_mutexattr_destroy(&__attr);
     return __ec;
   }
-  __ec = pthread_mutex_init(__m, &attr);
+  __ec = pthread_mutex_init(__m, &__attr);
   if (__ec) {
-    pthread_mutexattr_destroy(&attr);
+    pthread_mutexattr_destroy(&__attr);
     return __ec;
   }
-  __ec = pthread_mutexattr_destroy(&attr);
+  __ec = pthread_mutexattr_destroy(&__attr);
   if (__ec) {
     pthread_mutex_destroy(__m);
     return __ec;
@@ -380,8 +380,8 @@ int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
 
 __libcpp_thread_id __libcpp_thread_get_current_id()
 {
-  const __libcpp_thread_t thread = pthread_self();
-  return __libcpp_thread_get_id(&thread);
+  const __libcpp_thread_t __current_thread = pthread_self();
+  return __libcpp_thread_get_id(&__current_thread);
 }
 
 __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
index c260f9f..daf3d1a 100644 (file)
@@ -795,11 +795,11 @@ bitset<_Size>::bitset(const _CharT* __str,
         if (__str[__i] != __zero && __str[__i] != __one)
             __throw_invalid_argument("bitset string ctor has invalid argument");
 
-    size_t _Mp = _VSTD::min(__rlen, _Size);
+    size_t __mp = _VSTD::min(__rlen, _Size);
     size_t __i = 0;
-    for (; __i < _Mp; ++__i)
+    for (; __i < __mp; ++__i)
     {
-        _CharT __c = __str[_Mp - 1 - __i];
+        _CharT __c = __str[__mp - 1 - __i];
         (*this)[__i] = (__c == __one);
     }
     _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
@@ -821,11 +821,11 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
         if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
             __throw_invalid_argument("bitset string ctor has invalid argument");
 
-    size_t _Mp = _VSTD::min(__rlen, _Size);
+    size_t __mp = _VSTD::min(__rlen, _Size);
     size_t __i = 0;
-    for (; __i < _Mp; ++__i)
+    for (; __i < __mp; ++__i)
     {
-        _CharT __c = __str[__pos + _Mp - 1 - __i];
+        _CharT __c = __str[__pos + __mp - 1 - __i];
         (*this)[__i] = _Traits::eq(__c, __one);
     }
     _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
@@ -956,8 +956,8 @@ bitset<_Size>::flip(size_t __pos)
     if (__pos >= _Size)
         __throw_out_of_range("bitset flip argument out of range");
 
-    reference r = base::__make_ref(__pos);
-    r = ~r;
+    reference __r = base::__make_ref(__pos);
+    __r = ~__r;
     return *this;
 }
 
index 2f14a47..eda0a77 100644 (file)
@@ -1120,7 +1120,7 @@ template <class _Rp>
 _Rp
 future<_Rp>::get()
 {
-    unique_ptr<__shared_count, __release_shared_count> __(__state_);
+    unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
     __assoc_state<_Rp>* __s = __state_;
     __state_ = nullptr;
     return __s->move();
@@ -1202,7 +1202,7 @@ template <class _Rp>
 _Rp&
 future<_Rp&>::get()
 {
-    unique_ptr<__shared_count, __release_shared_count> __(__state_);
+    unique_ptr<__shared_count, __release_shared_count> __guard(__state_);
     __assoc_state<_Rp&>* __s = __state_;
     __state_ = nullptr;
     return __s->copy();
index d93fba8..09e0d11 100644 (file)
@@ -262,9 +262,9 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
 {
     using namespace chrono;
     unique_lock<mutex> __lk(__m_);
-    bool no_timeout = _Clock::now() < __t;
-    while (no_timeout && __locked_)
-        no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
+    bool __no_timeout = _Clock::now() < __t;
+    while (__no_timeout && __locked_)
+        __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
     if (!__locked_)
     {
         __locked_ = true;
@@ -304,7 +304,7 @@ recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration
 {
     using namespace chrono;
     __thread_id __id = this_thread::get_id();
-    unique_lock<mutex> lk(__m_);
+    unique_lock<mutex> __lk(__m_);
     if (__id == __id_)
     {
         if (__count_ == numeric_limits<size_t>::max())
@@ -312,9 +312,9 @@ recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration
         ++__count_;
         return true;
     }
-    bool no_timeout = _Clock::now() < __t;
-    while (no_timeout && __count_ != 0)
-        no_timeout = __cv_.wait_until(lk, __t) == cv_status::no_timeout;
+    bool __no_timeout = _Clock::now() < __t;
+    while (__no_timeout && __count_ != 0)
+        __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout;
     if (__count_ == 0)
     {
         __count_ = 1;
index 06c017f..f4fb7a3 100644 (file)
@@ -4131,9 +4131,9 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
 {
     // Found [=
     //   This means =] must exist
-    value_type _Equal_close[2] = {'=', ']'};
-    _ForwardIterator __temp = _VSTD::search(__first, __last, _Equal_close,
-                                                            _Equal_close+2);
+    value_type __equal_close[2] = {'=', ']'};
+    _ForwardIterator __temp = _VSTD::search(__first, __last, __equal_close,
+                                                            __equal_close+2);
     if (__temp == __last)
         __throw_regex_error<regex_constants::error_brack>();
     // [__first, __temp) contains all text in [= ... =]
@@ -4173,9 +4173,9 @@ basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
 {
     // Found [:
     //   This means :] must exist
-    value_type _Colon_close[2] = {':', ']'};
-    _ForwardIterator __temp = _VSTD::search(__first, __last, _Colon_close,
-                                                            _Colon_close+2);
+    value_type __colon_close[2] = {':', ']'};
+    _ForwardIterator __temp = _VSTD::search(__first, __last, __colon_close,
+                                                            __colon_close+2);
     if (__temp == __last)
         __throw_regex_error<regex_constants::error_brack>();
     // [__first, __temp) contains all text in [: ... :]
@@ -4198,9 +4198,9 @@ basic_regex<_CharT, _Traits>::__parse_collating_symbol(_ForwardIterator __first,
 {
     // Found [.
     //   This means .] must exist
-    value_type _Dot_close[2] = {'.', ']'};
-    _ForwardIterator __temp = _VSTD::search(__first, __last, _Dot_close,
-                                                            _Dot_close+2);
+    value_type __dot_close[2] = {'.', ']'};
+    _ForwardIterator __temp = _VSTD::search(__first, __last, __dot_close,
+                                                            __dot_close+2);
     if (__temp == __last)
         __throw_regex_error<regex_constants::error_brack>();
     // [__first, __temp) contains all text in [. ... .]
@@ -5861,7 +5861,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
 {
     deque<__state> __states;
     ptrdiff_t __highest_j = 0;
-    ptrdiff_t _Np = _VSTD::distance(__first, __last);
+    ptrdiff_t __np = _VSTD::distance(__first, __last);
     __node* __st = __start_.get();
     if (__st)
     {
@@ -5904,7 +5904,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
                 if (!__matched || __highest_j < __s.__current_ - __s.__first_)
                     __highest_j = __s.__current_ - __s.__first_;
                 __matched = true;
-                if (__highest_j == _Np)
+                if (__highest_j == __np)
                     __states.clear();
                 else
                     __states.pop_back();
@@ -5956,7 +5956,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
     vector<__state> __states;
     __state __best_state;
     ptrdiff_t __highest_j = 0;
-    ptrdiff_t _Np = _VSTD::distance(__first, __last);
+    ptrdiff_t __np = _VSTD::distance(__first, __last);
     __node* __st = __start_.get();
     if (__st)
     {
@@ -6008,7 +6008,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
                     __best_state = __s;
                 }
                 __matched = true;
-                if (__highest_j == _Np)
+                if (__highest_j == __np)
                     __states.clear();
                 else
                     __states.pop_back();
index ddccb28..73cbc7f 100644 (file)
@@ -172,11 +172,11 @@ public:
     _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
     bool try_acquire_until(chrono::time_point<Clock, Duration> const& __abs_time)
     {
-        auto const current = Clock::now();
-        if (current >= __abs_time)
+        auto const __current = Clock::now();
+        if (__current >= __abs_time)
             return try_acquire();
         else
-            return try_acquire_for(__abs_time - current);
+            return try_acquire_for(__abs_time - __current);
     }
 };
 
index 6919898..7f3c92b 100644 (file)
@@ -293,11 +293,11 @@ shared_timed_mutex::try_lock_shared_until(
     {
         while (true)
         {
-            cv_status status = __base_.__gate1_.wait_until(__lk, __abs_time);
+            cv_status __status = __base_.__gate1_.wait_until(__lk, __abs_time);
             if ((__base_.__state_ & __base_.__write_entered_) == 0 &&
                                        (__base_.__state_ & __base_.__n_readers_) < __base_.__n_readers_)
                 break;
-            if (status == cv_status::timeout)
+            if (__status == cv_status::timeout)
                 return false;
         }
     }
index 7a1117f..2d4229d 100644 (file)
@@ -367,10 +367,10 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d)
         // The standard guarantees a 64bit signed integer resolution for nanoseconds,
         // so use INT64_MAX / 1e9 as cut-off point. Use a constant to avoid <climits>
         // and issues with long double folding on PowerPC with GCC.
-        _LIBCPP_CONSTEXPR chrono::duration<long double> _Max =
+        _LIBCPP_CONSTEXPR chrono::duration<long double> __max =
             chrono::duration<long double>(9223372036.0L);
         chrono::nanoseconds __ns;
-        if (__d < _Max)
+        if (__d < __max)
         {
             __ns = chrono::duration_cast<chrono::nanoseconds>(__d);
             if (__ns < __d)
index 13c8982..0d2d8c4 100644 (file)
@@ -594,9 +594,9 @@ private:
   template <class _Fp, class _Vp, class... _Vs>
   _LIBCPP_HIDE_FROM_ABI
   static constexpr auto __make_fdiagonal() {
-    constexpr size_t _Np = __remove_cvref_t<_Vp>::__size();
-    static_assert(__all<(_Np == __remove_cvref_t<_Vs>::__size())...>::value);
-    return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<_Np>{});
+    constexpr size_t __np = __remove_cvref_t<_Vp>::__size();
+    static_assert(__all<(__np == __remove_cvref_t<_Vs>::__size())...>::value);
+    return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<__np>{});
   }
 
   template <class _Fp, class... _Vs, size_t... _Is>