[libcxx-commits] [libcxx] d05f889 - [libc++] Enable radability-identifier-naming for local variables and fix any problems
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Feb 11 11:03:58 PST 2023
Author: Nikolas Klauser
Date: 2023-02-11T20:03:53+01:00
New Revision: d05f889535ab10eb6de032523a29a4e4850e328a
URL: https://github.com/llvm/llvm-project/commit/d05f889535ab10eb6de032523a29a4e4850e328a
DIFF: https://github.com/llvm/llvm-project/commit/d05f889535ab10eb6de032523a29a4e4850e328a.diff
LOG: [libc++] Enable radability-identifier-naming for local variables and fix any problems
Fixes #60658
Reviewed By: Mordante, #libc
Spies: aheejin, sstefan1, libcxx-commits
Differential Revision: https://reviews.llvm.org/D143737
Added:
Modified:
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
Removed:
################################################################################
diff --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy
index 4bc25c3ae605..8f7cef99b802 100644
--- a/libcxx/.clang-tidy
+++ b/libcxx/.clang-tidy
@@ -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,
diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h
index a0e56e2046f5..fcdeda3f1d16 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -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) {
-
diff erence_type tz_left = __libcpp_ctz(__left_bitset);
- __left_bitset = __libcpp_blsr(__left_bitset);
-
diff erence_type tz_right = __libcpp_ctz(__right_bitset);
- __right_bitset = __libcpp_blsr(__right_bitset);
- _Ops::iter_swap(__first + tz_left, __last - tz_right);
+
diff erence_type __tz_left = __libcpp_ctz(__left_bitset);
+ __left_bitset = __libcpp_blsr(__left_bitset);
+
diff erence_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) {
diff erence_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) {
diff erence_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;
}
diff --git a/libcxx/include/__bit/bit_ceil.h b/libcxx/include/__bit/bit_ceil.h
index a558d6194270..1332900ae799 100644
--- a/libcxx/include/__bit/bit_ceil.h
+++ b/libcxx/include/__bit/bit_ceil.h
@@ -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);
}
}
diff --git a/libcxx/include/__chrono/duration.h b/libcxx/include/__chrono/duration.h
index afcc38b5cfc0..af0e7d3d6eb4 100644
--- a/libcxx/include/__chrono/duration.h
+++ b/libcxx/include/__chrono/duration.h
@@ -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;
}
diff --git a/libcxx/include/__compare/common_comparison_category.h b/libcxx/include/__compare/common_comparison_category.h
index 06c4b28491e3..cd28d2c72171 100644
--- a/libcxx/include/__compare/common_comparison_category.h
+++ b/libcxx/include/__compare/common_comparison_category.h
@@ -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");
diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h
index 297e4e5103a3..0a7045655fd1 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -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>
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 9f92f6181468..f8023df210db 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -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;
}
};
diff --git a/libcxx/include/__iterator/advance.h b/libcxx/include/__iterator/advance.h
index 154c2736f313..8ccbe6f5a0cb 100644
--- a/libcxx/include/__iterator/advance.h
+++ b/libcxx/include/__iterator/advance.h
@@ -159,9 +159,9 @@ struct __fn {
__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)`.
diff --git a/libcxx/include/__random/clamp_to_integral.h b/libcxx/include/__random/clamp_to_integral.h
index 7d44ff9cfcad..85f8aa574ea1 100644
--- a/libcxx/include/__random/clamp_to_integral.h
+++ b/libcxx/include/__random/clamp_to_integral.h
@@ -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();
diff --git a/libcxx/include/__random/generate_canonical.h b/libcxx/include/__random/generate_canonical.h
index 5fada6df5903..5f0aa6fd850b 100644
--- a/libcxx/include/__random/generate_canonical.h
+++ b/libcxx/include/__random/generate_canonical.h
@@ -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
diff --git a/libcxx/include/__random/independent_bits_engine.h b/libcxx/include/__random/independent_bits_engine.h
index 151492a81bd0..f4a23bbb5098 100644
--- a/libcxx/include/__random/independent_bits_engine.h
+++ b/libcxx/include/__random/independent_bits_engine.h
@@ -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>
diff --git a/libcxx/include/__random/mersenne_twister_engine.h b/libcxx/include/__random/mersenne_twister_engine.h
index 3a58e311b001..eb5f56f42dba 100644
--- a/libcxx/include/__random/mersenne_twister_engine.h
+++ b/libcxx/include/__random/mersenne_twister_engine.h
@@ -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;
diff --git a/libcxx/include/__random/normal_distribution.h b/libcxx/include/__random/normal_distribution.h
index b2ed47e6af46..93f3d1f531ba 100644
--- a/libcxx/include/__random/normal_distribution.h
+++ b/libcxx/include/__random/normal_distribution.h
@@ -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;
}
diff --git a/libcxx/include/__random/piecewise_linear_distribution.h b/libcxx/include/__random/piecewise_linear_distribution.h
index fc2eb47c7b0f..0430b2437ced 100644
--- a/libcxx/include/__random/piecewise_linear_distribution.h
+++ b/libcxx/include/__random/piecewise_linear_distribution.h
@@ -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>
diff --git a/libcxx/include/__random/poisson_distribution.h b/libcxx/include/__random/poisson_distribution.h
index 334c6102b341..2b39937ab8b3 100644
--- a/libcxx/include/__random/poisson_distribution.h
+++ b/libcxx/include/__random/poisson_distribution.h
@@ -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_;
}
}
diff --git a/libcxx/include/__random/shuffle_order_engine.h b/libcxx/include/__random/shuffle_order_engine.h
index 4a27289c2f81..86a60fc57b25 100644
--- a/libcxx/include/__random/shuffle_order_engine.h
+++ b/libcxx/include/__random/shuffle_order_engine.h
@@ -201,10 +201,10 @@ class _LIBCPP_TEMPLATE_VIS shuffle_order_engine
_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;
}
diff --git a/libcxx/include/__random/uniform_int_distribution.h b/libcxx/include/__random/uniform_int_distribution.h
index b7db8a3f9cbb..d0e548db2e98 100644
--- a/libcxx/include/__random/uniform_int_distribution.h
+++ b/libcxx/include/__random/uniform_int_distribution.h
@@ -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());
}
diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h
index 8f3564a8c760..db7e7d283c76 100644
--- a/libcxx/include/__ranges/drop_view.h
+++ b/libcxx/include/__ranges/drop_view.h
@@ -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.
diff --git a/libcxx/include/__ranges/elements_view.h b/libcxx/include/__ranges/elements_view.h
index 997380ee9c65..a80382b7fc42 100644
--- a/libcxx/include/__ranges/elements_view.h
+++ b/libcxx/include/__ranges/elements_view.h
@@ -224,9 +224,9 @@ class elements_view<_View, _Np>::__iterator
_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 @@ class elements_view<_View, _Np>::__iterator
_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+=(
diff erence_type __n)
diff --git a/libcxx/include/__ranges/filter_view.h b/libcxx/include/__ranges/filter_view.h
index e14a9abeb9e7..92ffb22fdb79 100644
--- a/libcxx/include/__ranges/filter_view.h
+++ b/libcxx/include/__ranges/filter_view.h
@@ -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
diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support
index dcf2763ad646..f758aa84fe9b 100644
--- a/libcxx/include/__threading_support
+++ b/libcxx/include/__threading_support
@@ -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)
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index c260f9f592c0..daf3d1ad2f73 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -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;
}
diff --git a/libcxx/include/future b/libcxx/include/future
index 2f14a471c458..eda0a773cb49 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -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();
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index d93fba8f801c..09e0d11ddfb3 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -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;
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 06c017fcce38..f4fb7a38a6ce 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -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;
ptr
diff _t __highest_j = 0;
- ptr
diff _t _Np = _VSTD::distance(__first, __last);
+ ptr
diff _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;
ptr
diff _t __highest_j = 0;
- ptr
diff _t _Np = _VSTD::distance(__first, __last);
+ ptr
diff _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();
diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore
index ddccb28dab47..73cbc7f40a54 100644
--- a/libcxx/include/semaphore
+++ b/libcxx/include/semaphore
@@ -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);
}
};
diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex
index 6919898f66f4..7f3c92baeebc 100644
--- a/libcxx/include/shared_mutex
+++ b/libcxx/include/shared_mutex
@@ -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;
}
}
diff --git a/libcxx/include/thread b/libcxx/include/thread
index 7a1117f555a7..2d4229db2290 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -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)
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 13c89822ca77..0d2d8c49a44a 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -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>
More information about the libcxx-commits
mailing list