[libc++][clang-tidy] Enable readability-simplify-boolean-expr

Reviewed By: ldionne, #libc

Spies: Eugene.Zelenko, aheejin, libcxx-commits, xazax.hun

Differential Revision: https://reviews.llvm.org/D137804
This commit is contained in:
Nikolas Klauser 2022-11-10 23:57:43 +01:00
parent 4b6b248731
commit 3574b800cf
6 changed files with 11 additions and 11 deletions

View File

@ -25,6 +25,7 @@ Checks: >
readability-redundant-control-flow,
readability-redundant-function-ptr-dereference,
readability-redundant-preprocessor,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-uniqueptr-delete-release,
@ -63,4 +64,4 @@ CheckOptions:
# readability-redundant-access-specifiers,
# readability-redundant-declaration,
# readability-redundant-member-init,
# readability-simplify-boolean-expr,
#

View File

@ -369,10 +369,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break(
if (__prev == __property::__Regional_Indicator && __next == __property::__Regional_Indicator) { // GB12 + GB13
__ri_break_allowed = !__ri_break_allowed;
if (__ri_break_allowed)
return true;
return false;
return __ri_break_allowed;
}
// *** Otherwise, break everywhere. ***

View File

@ -701,7 +701,7 @@ public:
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
{
for (; __low != __high; ++__low)
if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
if (!isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m))
break;
return __low;
}

View File

@ -250,7 +250,7 @@ struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp>
int __i = digits;
do
{
if (!('0' <= *__p && *__p <= '9'))
if (*__p < '0' || *__p > '9')
break;
__cprod[--__i] = *__p++ - '0';
} while (__p != __ep && __i != 0);

View File

@ -753,9 +753,10 @@ basic_filebuf<_CharT, _Traits>::underflow()
}
else
{
_LIBCPP_ASSERT ( !(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
if (__extbufend_ != __extbufnext_)
if (__extbufend_ != __extbufnext_) {
_LIBCPP_ASSERT(__extbufnext_ != nullptr, "underflow moving from NULL" );
_VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
}
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),

View File

@ -4013,9 +4013,10 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
}
else
{
_LIBCPP_ASSERT(!(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
if (__extbufend_ != __extbufnext_)
if (__extbufend_ != __extbufnext_) {
_LIBCPP_ASSERT(__extbufnext_ != NULL, "underflow moving from NULL" );
_VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
}
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),