[libcxx-commits] [libcxx] 3574b80 - [libc++][clang-tidy] Enable readability-simplify-boolean-expr
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 23 15:42:25 PST 2022
Author: Nikolas Klauser
Date: 2022-11-24T00:42:19+01:00
New Revision: 3574b800cf72c3209e6200eee9fb93fd0228ad5f
URL: https://github.com/llvm/llvm-project/commit/3574b800cf72c3209e6200eee9fb93fd0228ad5f
DIFF: https://github.com/llvm/llvm-project/commit/3574b800cf72c3209e6200eee9fb93fd0228ad5f.diff
LOG: [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
Added:
Modified:
libcxx/.clang-tidy
libcxx/include/__format/unicode.h
libcxx/include/__locale
libcxx/include/charconv
libcxx/include/fstream
libcxx/include/locale
Removed:
################################################################################
diff --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy
index 88b9de1f56a81..4bc25c3ae6059 100644
--- a/libcxx/.clang-tidy
+++ b/libcxx/.clang-tidy
@@ -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,
+#
diff --git a/libcxx/include/__format/unicode.h b/libcxx/include/__format/unicode.h
index 94d3e21848360..50f66e72570bf 100644
--- a/libcxx/include/__format/unicode.h
+++ b/libcxx/include/__format/unicode.h
@@ -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. ***
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index e02724c862e25..f1e0a07fd06b6 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -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;
}
diff --git a/libcxx/include/charconv b/libcxx/include/charconv
index d2031eac8ba9b..4063117b30ad4 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -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);
diff --git a/libcxx/include/fstream b/libcxx/include/fstream
index b8417f3e6c02d..65b22a4db70a9 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -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),
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 015efd8b0dc71..c00b1dfc9375b 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -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),
More information about the libcxx-commits
mailing list