diff --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy --- a/libcxx/.clang-tidy +++ b/libcxx/.clang-tidy @@ -1,2 +1,2 @@ InheritParentConfig: true -Checks: '-readability-identifier-naming' +Checks: '-readability-identifier-naming,-llvm-header-guard,-llvm-include-order,-misc-unconventional-assign-operator' diff --git a/libcxx/include/__algorithm/copy.h b/libcxx/include/__algorithm/copy.h --- a/libcxx/include/__algorithm/copy.h +++ b/libcxx/include/__algorithm/copy.h @@ -62,14 +62,13 @@ _OutputIterator copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { - if (__libcpp_is_constant_evaluated()) { + if (__libcpp_is_constant_evaluated()) return _VSTD::__copy_constexpr(__first, __last, __result); - } else { - return _VSTD::__rewrap_iter(__result, - _VSTD::__copy(_VSTD::__unwrap_iter(__first), - _VSTD::__unwrap_iter(__last), - _VSTD::__unwrap_iter(__result))); - } + + return _VSTD::__rewrap_iter(__result, + _VSTD::__copy(_VSTD::__unwrap_iter(__first), + _VSTD::__unwrap_iter(__last), + _VSTD::__unwrap_iter(__result))); } _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__algorithm/copy_backward.h b/libcxx/include/__algorithm/copy_backward.h --- a/libcxx/include/__algorithm/copy_backward.h +++ b/libcxx/include/__algorithm/copy_backward.h @@ -64,14 +64,13 @@ copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) { - if (__libcpp_is_constant_evaluated()) { + if (__libcpp_is_constant_evaluated()) return _VSTD::__copy_backward_constexpr(__first, __last, __result); - } else { - return _VSTD::__rewrap_iter(__result, - _VSTD::__copy_backward(_VSTD::__unwrap_iter(__first), - _VSTD::__unwrap_iter(__last), - _VSTD::__unwrap_iter(__result))); - } + + return _VSTD::__rewrap_iter(__result, + _VSTD::__copy_backward(_VSTD::__unwrap_iter(__first), + _VSTD::__unwrap_iter(__last), + _VSTD::__unwrap_iter(__result))); } _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__algorithm/is_permutation.h b/libcxx/include/__algorithm/is_permutation.h --- a/libcxx/include/__algorithm/is_permutation.h +++ b/libcxx/include/__algorithm/is_permutation.h @@ -86,7 +86,7 @@ break; if (__first1 == __last1) return __first2 == __last2; - else if (__first2 == __last2) + if (__first2 == __last2) return false; typedef typename iterator_traits<_ForwardIterator1>::difference_type _D1; diff --git a/libcxx/include/__algorithm/minmax_element.h b/libcxx/include/__algorithm/minmax_element.h --- a/libcxx/include/__algorithm/minmax_element.h +++ b/libcxx/include/__algorithm/minmax_element.h @@ -28,44 +28,39 @@ static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, "std::minmax_element requires a ForwardIterator"); pair<_ForwardIterator, _ForwardIterator> __result(__first, __first); - if (__first != __last) + if (__first == __last || ++__first == __last) + return __result; + + if (__comp(*__first, *__result.first)) + __result.first = __first; + else + __result.second = __first; + + while (++__first != __last) { - if (++__first != __last) - { - if (__comp(*__first, *__result.first)) - __result.first = __first; - else - __result.second = __first; - while (++__first != __last) - { - _ForwardIterator __i = __first; - if (++__first == __last) - { - if (__comp(*__i, *__result.first)) - __result.first = __i; - else if (!__comp(*__i, *__result.second)) - __result.second = __i; - break; - } - else - { - if (__comp(*__first, *__i)) - { - if (__comp(*__first, *__result.first)) - __result.first = __first; - if (!__comp(*__i, *__result.second)) - __result.second = __i; - } - else - { - if (__comp(*__i, *__result.first)) - __result.first = __i; - if (!__comp(*__first, *__result.second)) - __result.second = __first; - } - } - } - } + _ForwardIterator __i = __first; + if (++__first == __last) + { + if (__comp(*__i, *__result.first)) + __result.first = __i; + else if (!__comp(*__i, *__result.second)) + __result.second = __i; + break; + } + if (__comp(*__first, *__i)) + { + if (__comp(*__first, *__result.first)) + __result.first = __first; + if (!__comp(*__i, *__result.second)) + __result.second = __i; + } + else + { + if (__comp(*__i, *__result.first)) + __result.first = __i; + if (!__comp(*__first, *__result.second)) + __result.second = __first; + } } return __result; } diff --git a/libcxx/include/__algorithm/move.h b/libcxx/include/__algorithm/move.h --- a/libcxx/include/__algorithm/move.h +++ b/libcxx/include/__algorithm/move.h @@ -63,14 +63,13 @@ _OutputIterator move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { - if (__libcpp_is_constant_evaluated()) { + if (__libcpp_is_constant_evaluated()) return _VSTD::__move_constexpr(__first, __last, __result); - } else { - return _VSTD::__rewrap_iter(__result, - _VSTD::__move(_VSTD::__unwrap_iter(__first), - _VSTD::__unwrap_iter(__last), - _VSTD::__unwrap_iter(__result))); - } + + return _VSTD::__rewrap_iter(__result, + _VSTD::__move(_VSTD::__unwrap_iter(__first), + _VSTD::__unwrap_iter(__last), + _VSTD::__unwrap_iter(__result))); } _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__algorithm/move_backward.h b/libcxx/include/__algorithm/move_backward.h --- a/libcxx/include/__algorithm/move_backward.h +++ b/libcxx/include/__algorithm/move_backward.h @@ -64,14 +64,14 @@ move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) { - if (__libcpp_is_constant_evaluated()) { + if (__libcpp_is_constant_evaluated()) return _VSTD::__move_backward_constexpr(__first, __last, __result); - } else { - return _VSTD::__rewrap_iter(__result, - _VSTD::__move_backward(_VSTD::__unwrap_iter(__first), - _VSTD::__unwrap_iter(__last), - _VSTD::__unwrap_iter(__result))); - } + + return _VSTD::__rewrap_iter(__result, + _VSTD::__move_backward(_VSTD::__unwrap_iter(__first), + _VSTD::__unwrap_iter(__last), + _VSTD::__unwrap_iter(__result))); + } _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__algorithm/nth_element.h b/libcxx/include/__algorithm/nth_element.h --- a/libcxx/include/__algorithm/nth_element.h +++ b/libcxx/include/__algorithm/nth_element.h @@ -100,9 +100,9 @@ __j = __last; if (!__comp(*__first, *--__j)) { // we need a guard if *__first == *(__last-1) while (true) { - if (__i == __j) { + if (__i == __j) return; // [__first, __last) all equivalent elements - } else if (__comp(*__first, *__i)) { + if (__comp(*__first, *__i)) { swap(*__i, *__j); ++__n_swaps; ++__i; 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 @@ -442,13 +442,11 @@ __last = __i; continue; } - else + + if (__fs) { - if (__fs) - { - __first = ++__i; - continue; - } + __first = ++__i; + continue; } } // sort smaller range with recursive call and larger with tail recursion elimination diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference --- a/libcxx/include/__bit_reference +++ b/libcxx/include/__bit_reference @@ -921,13 +921,10 @@ _VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first)); break; } - else - { - __bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle); - __first = __middle; - __middle = __mp; - __d2 -= __d1; - } + __bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle); + __first = __middle; + __middle = __mp; + __d2 -= __d1; } else { @@ -938,13 +935,10 @@ _VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last)); break; } - else - { - __bit_iterator<_Cp, false> __mp = __first + __d2; - _VSTD::swap_ranges(__first, __mp, __middle); - __first = __mp; - __d1 -= __d2; - } + __bit_iterator<_Cp, false> __mp = __first + __d2; + _VSTD::swap_ranges(__first, __mp, __middle); + __first = __mp; + __d1 -= __d2; } } return __r; diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -871,8 +871,7 @@ return nullptr; if (__policy_->__clone) // Out of line storage. return reinterpret_cast(__buf_.__large); - else - return reinterpret_cast(&__buf_.__small); + return reinterpret_cast(&__buf_.__small); } #endif // _LIBCPP_NO_RTTI }; 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 @@ -221,15 +221,13 @@ __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) { const char* __s = static_cast(__key); - if (__len <= 32) { - if (__len <= 16) { - return __hash_len_0_to_16(__s, __len); - } else { - return __hash_len_17_to_32(__s, __len); - } - } else if (__len <= 64) { + + if (__len <= 16) + return __hash_len_0_to_16(__s, __len); + if (__len <= 32) + return __hash_len_17_to_32(__s, __len); + if (__len <= 64) return __hash_len_33_to_64(__s, __len); - } // For strings over 64 bytes we hash the end first, and then as we // loop we keep 56 bytes of state: v, w, x, y, and z. diff --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h --- a/libcxx/include/__memory/allocator.h +++ b/libcxx/include/__memory/allocator.h @@ -99,11 +99,9 @@ _Tp* allocate(size_t __n) { if (__n > allocator_traits::max_size(*this)) __throw_bad_array_new_length(); - if (__libcpp_is_constant_evaluated()) { + if (__libcpp_is_constant_evaluated()) return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp))); - } else { - return static_cast<_Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); - } + return static_cast<_Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -181,11 +179,9 @@ const _Tp* allocate(size_t __n) { if (__n > allocator_traits::max_size(*this)) __throw_bad_array_new_length(); - if (__libcpp_is_constant_evaluated()) { + if (__libcpp_is_constant_evaluated()) return static_cast(::operator new(__n * sizeof(_Tp))); - } else { - return static_cast(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); - } + return static_cast(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 diff --git a/libcxx/include/__tree b/libcxx/include/__tree --- a/libcxx/include/__tree +++ b/libcxx/include/__tree @@ -1945,11 +1945,8 @@ __parent = static_cast<__parent_pointer>(__hint.__ptr_); return __parent->__left_; } - else - { - __parent = static_cast<__parent_pointer>(__prior.__ptr_); - return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_; - } + __parent = static_cast<__parent_pointer>(__prior.__ptr_); + return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_; } // __v < *prev(__hint) return __find_leaf_high(__parent, __v); @@ -2032,16 +2029,13 @@ __parent = static_cast<__parent_pointer>(__hint.__ptr_); return __parent->__left_; } - else - { - __parent = static_cast<__parent_pointer>(__prior.__ptr_); - return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_; - } + __parent = static_cast<__parent_pointer>(__prior.__ptr_); + return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_; } // __v <= *prev(__hint) return __find_equal(__parent, __v); } - else if (value_comp()(*__hint, __v)) // check after + if (value_comp()(*__hint, __v)) // check after { // *__hint < __v const_iterator __next = _VSTD::next(__hint); @@ -2053,11 +2047,8 @@ __parent = static_cast<__parent_pointer>(__hint.__ptr_); return static_cast<__node_base_pointer>(__hint.__ptr_)->__right_; } - else - { - __parent = static_cast<__parent_pointer>(__next.__ptr_); - return __parent->__left_; - } + __parent = static_cast<__parent_pointer>(__next.__ptr_); + return __parent->__left_; } // *next(__hint) <= __v return __find_equal(__parent, __v); diff --git a/libcxx/include/bit b/libcxx/include/bit --- a/libcxx/include/bit +++ b/libcxx/include/bit @@ -118,21 +118,19 @@ if (sizeof(_Tp) <= sizeof(unsigned int)) return __libcpp_ctz(static_cast(__t)); - else if (sizeof(_Tp) <= sizeof(unsigned long)) + if (sizeof(_Tp) <= sizeof(unsigned long)) return __libcpp_ctz(static_cast(__t)); - else if (sizeof(_Tp) <= sizeof(unsigned long long)) + if (sizeof(_Tp) <= sizeof(unsigned long long)) return __libcpp_ctz(static_cast(__t)); - else + + int __ret = 0; + const unsigned int __ulldigits = numeric_limits::digits; + while (static_cast(__t) == 0uLL) { - int __ret = 0; - const unsigned int __ulldigits = numeric_limits::digits; - while (static_cast(__t) == 0uLL) - { - __ret += __ulldigits; - __t >>= __ulldigits; - } - return __ret + __libcpp_ctz(static_cast(__t)); + __ret += __ulldigits; + __t >>= __ulldigits; } + return __ret + __libcpp_ctz(static_cast(__t)); } template @@ -146,25 +144,23 @@ if (sizeof(_Tp) <= sizeof(unsigned int)) return __libcpp_clz(static_cast(__t)) - (numeric_limits::digits - numeric_limits<_Tp>::digits); - else if (sizeof(_Tp) <= sizeof(unsigned long)) + if (sizeof(_Tp) <= sizeof(unsigned long)) return __libcpp_clz(static_cast(__t)) - (numeric_limits::digits - numeric_limits<_Tp>::digits); - else if (sizeof(_Tp) <= sizeof(unsigned long long)) + if (sizeof(_Tp) <= sizeof(unsigned long long)) return __libcpp_clz(static_cast(__t)) - (numeric_limits::digits - numeric_limits<_Tp>::digits); - else - { - int __ret = 0; - int __iter = 0; - const unsigned int __ulldigits = numeric_limits::digits; - while (true) { - __t = __rotr(__t, __ulldigits); - if ((__iter = __countl_zero(static_cast(__t))) != __ulldigits) - break; - __ret += __iter; - } - return __ret + __iter; - } + + int __ret = 0; + int __iter = 0; + const unsigned int __ulldigits = numeric_limits::digits; + while (true) { + __t = __rotr(__t, __ulldigits); + if ((__iter = __countl_zero(static_cast(__t))) != __ulldigits) + break; + __ret += __iter; + } + return __ret + __iter; } template @@ -194,20 +190,18 @@ static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__popcount requires an unsigned integer type"); if (sizeof(_Tp) <= sizeof(unsigned int)) return __libcpp_popcount(static_cast(__t)); - else if (sizeof(_Tp) <= sizeof(unsigned long)) + if (sizeof(_Tp) <= sizeof(unsigned long)) return __libcpp_popcount(static_cast(__t)); - else if (sizeof(_Tp) <= sizeof(unsigned long long)) + if (sizeof(_Tp) <= sizeof(unsigned long long)) return __libcpp_popcount(static_cast(__t)); - else + + int __ret = 0; + while (__t != 0) { - int __ret = 0; - while (__t != 0) - { - __ret += __libcpp_popcount(static_cast(__t)); - __t >>= numeric_limits::digits; - } - return __ret; + __ret += __libcpp_popcount(static_cast(__t)); + __t >>= numeric_limits::digits; } + return __ret; } // integral log base 2 diff --git a/libcxx/include/charconv b/libcxx/include/charconv --- a/libcxx/include/charconv +++ b/libcxx/include/charconv @@ -298,8 +298,7 @@ if (__tx::digits <= __diff || __tx::__width(__value) <= __diff) return {__tx::__convert(__value, __first), errc(0)}; - else - return {__last, errc::value_too_large}; + return {__last, errc::value_too_large}; } template @@ -447,12 +446,11 @@ { if (__base <= 10) return {'0' <= __c && __c < '0' + __base, __c - '0'}; - else if (__in_pattern(__c)) + if (__in_pattern(__c)) return {true, __c - '0'}; - else if ('a' <= __c && __c < 'a' + __base - 10) + if ('a' <= __c && __c < 'a' + __base - 10) return {true, __c - 'a' + 10}; - else - return {'A' <= __c && __c < 'A' + __base - 10, __c - 'A' + 10}; + return {'A' <= __c && __c < 'A' + __base - 10, __c - 'A' + 10}; } template @@ -472,11 +470,8 @@ { if (__p == __first) return {__first, errc::invalid_argument}; - else - { - __value = 0; - return {__p, {}}; - } + __value = 0; + return {__p, {}}; } auto __r = __f(__p, __last, __value, __args...); diff --git a/libcxx/include/chrono b/libcxx/include/chrono --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -2687,17 +2687,18 @@ constexpr hours make12(const hours& __h) noexcept { - if (__h == hours( 0)) return hours(12); - else if (__h <= hours(12)) return __h; - else return __h - hours(12); + if (__h == hours( 0)) + return hours(12); + if (__h <= hours(12)) + return __h; + return __h - hours(12); } constexpr hours make24(const hours& __h, bool __is_pm) noexcept { if (__is_pm) return __h == hours(12) ? __h : __h + hours(12); - else - return __h == hours(12) ? hours(0) : __h; + return __h == hours(12) ? hours(0) : __h; } #endif // _LIBCPP_STD_VER > 17 diff --git a/libcxx/include/cmath b/libcxx/include/cmath --- a/libcxx/include/cmath +++ b/libcxx/include/cmath @@ -623,8 +623,7 @@ const _Fp __x = __a + __t * (__b - __a); if ((__t > 1) == (__b > __a)) return __b < __x ? __x : __b; - else - return __x < __b ? __x : __b; + return __x < __b ? __x : __b; } constexpr float @@ -660,11 +659,10 @@ _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)) { + if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) return _Lim::max(); - } else if (__r <= _Lim::lowest()) { + if (__r <= _Lim::lowest()) return _Lim::min(); - } return static_cast<_IntT>(__r); } diff --git a/libcxx/include/complex b/libcxx/include/complex --- a/libcxx/include/complex +++ b/libcxx/include/complex @@ -1177,8 +1177,7 @@ { if (__x.real() > 0) return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); - else - return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag())); + return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag())); } if (__x.real() < 0) return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag())); diff --git a/libcxx/include/locale b/libcxx/include/locale --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -758,15 +758,14 @@ __err = ios_base::failbit; return 0; } - else if (__current_errno == ERANGE || - __ll < numeric_limits<_Tp>::min() || - numeric_limits<_Tp>::max() < __ll) + if (__current_errno == ERANGE || + __ll < numeric_limits<_Tp>::min() || + numeric_limits<_Tp>::max() < __ll) { __err = ios_base::failbit; if (__ll > 0) return numeric_limits<_Tp>::max(); - else - return numeric_limits<_Tp>::min(); + return numeric_limits<_Tp>::min(); } return static_cast<_Tp>(__ll); } @@ -798,7 +797,7 @@ __err = ios_base::failbit; return 0; } - else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll) + if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll) { __err = ios_base::failbit; return numeric_limits<_Tp>::max(); @@ -852,7 +851,7 @@ __err = ios_base::failbit; return 0; } - else if (__current_errno == ERANGE) + if (__current_errno == ERANGE) __err = ios_base::failbit; return __ld; } @@ -1253,8 +1252,8 @@ ++__nf; break; } - else - *__oe++ = __ct.widen(*__nf); + + *__oe++ = __ct.widen(*__nf); } __ct.widen(__nf, __ne, __oe); __oe += __ne - __nf; diff --git a/libcxx/include/mutex b/libcxx/include/mutex --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -334,17 +334,12 @@ try_lock(_L0& __l0, _L1& __l1) { unique_lock<_L0> __u0(__l0, try_to_lock); - if (__u0.owns_lock()) - { - if (__l1.try_lock()) - { - __u0.release(); - return -1; - } - else - return 1; - } - return 0; + if (!__u0.owns_lock()) + return 0; + if (!__l1.try_lock()) + return 1; + __u0.release(); + return -1; } #ifndef _LIBCPP_CXX03_LANG diff --git a/libcxx/include/new b/libcxx/include/new --- a/libcxx/include/new +++ b/libcxx/include/new @@ -291,9 +291,8 @@ if (__is_overaligned_for_new(__align)) { const align_val_t __align_val = static_cast(__align); return __do_deallocate_handle_size(__ptr, __size, __align_val); - } else { - return __do_deallocate_handle_size(__ptr, __size); } + return __do_deallocate_handle_size(__ptr, __size); #endif } @@ -305,9 +304,8 @@ if (__is_overaligned_for_new(__align)) { const align_val_t __align_val = static_cast(__align); return __libcpp_operator_delete(__ptr, __align_val); - } else { - return __libcpp_operator_delete(__ptr); } + return __libcpp_operator_delete(__ptr); #endif } diff --git a/libcxx/include/regex b/libcxx/include/regex --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -3880,9 +3880,9 @@ { if (*__temp == '=') return __parse_equivalence_class(++__temp, __last, __ml); - else if (*__temp == ':') + if (*__temp == ':') return __parse_character_class(++__temp, __last, __ml); - else if (*__temp == '.') + if (*__temp == '.') __first = __parse_collating_symbol(++__temp, __last, __start_range); } unsigned __grammar = __get_grammar(__flags_); @@ -6375,12 +6375,11 @@ __match_ = value_type(); return *this; } - else if (_VSTD::regex_search(__start, __end_, __match_, *__pregex_, - __flags_ | regex_constants::match_not_null | - regex_constants::match_continuous)) + if (_VSTD::regex_search(__start, __end_, __match_, *__pregex_, + __flags_ | regex_constants::match_not_null | + regex_constants::match_continuous)) return *this; - else - ++__start; + ++__start; } __flags_ |= regex_constants::match_prev_avail; if (!_VSTD::regex_search(__start, __end_, __match_, *__pregex_, __flags_)) diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -170,8 +170,7 @@ 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/sstream b/libcxx/include/sstream --- a/libcxx/include/sstream +++ b/libcxx/include/sstream @@ -444,7 +444,7 @@ __hm_ = this->pptr(); return string_type(this->pbase(), __hm_, __str_.get_allocator()); } - else if (__mode_ & ios_base::in) + if (__mode_ & ios_base::in) return string_type(this->eback(), this->egptr(), __str_.get_allocator()); return string_type(__str_.get_allocator()); }