[libcxx-commits] [PATCH] D137804: [libc++][clang-tidy] Enable readability-siplify-boolean-expr

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Nov 20 03:53:20 PST 2022


philnik updated this revision to Diff 476740.
philnik marked an inline comment as done.
philnik added a comment.

- Rebased
- Address coment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137804/new/

https://reviews.llvm.org/D137804

Files:
  libcxx/.clang-tidy
  libcxx/include/__format/unicode.h
  libcxx/include/__locale
  libcxx/include/charconv
  libcxx/include/fstream
  libcxx/include/locale


Index: libcxx/include/locale
===================================================================
--- libcxx/include/locale
+++ libcxx/include/locale
@@ -4009,7 +4009,7 @@
         }
         else
         {
-             _LIBCPP_ASSERT(!(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
+             _LIBCPP_ASSERT(__extbufnext_ != NULL || __extbufend_ == __extbufnext_, "underflow moving from NULL" );
              if (__extbufend_ != __extbufnext_)
                 _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
             __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
Index: libcxx/include/fstream
===================================================================
--- libcxx/include/fstream
+++ libcxx/include/fstream
@@ -751,7 +751,7 @@
         }
         else
         {
-            _LIBCPP_ASSERT ( !(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
+            _LIBCPP_ASSERT (__extbufnext_ != NULL || __extbufend_ == __extbufnext_, "underflow moving from NULL" );
             if (__extbufend_ != __extbufnext_)
                 _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
             __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
Index: libcxx/include/charconv
===================================================================
--- libcxx/include/charconv
+++ libcxx/include/charconv
@@ -250,7 +250,7 @@
         int __i = digits;
         do
         {
-            if (!('0' <= *__p && *__p <= '9'))
+            if ('0' > *__p || *__p > '9')
                 break;
             __cprod[--__i] = *__p++ - '0';
         } while (__p != __ep && __i != 0);
Index: libcxx/include/__locale
===================================================================
--- libcxx/include/__locale
+++ libcxx/include/__locale
@@ -699,7 +699,7 @@
     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;
     }
Index: libcxx/include/__format/unicode.h
===================================================================
--- libcxx/include/__format/unicode.h
+++ libcxx/include/__format/unicode.h
@@ -369,10 +369,7 @@
 
   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. ***
Index: libcxx/.clang-tidy
===================================================================
--- libcxx/.clang-tidy
+++ libcxx/.clang-tidy
@@ -25,6 +25,7 @@
   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 @@
 # readability-redundant-access-specifiers,
 # readability-redundant-declaration,
 # readability-redundant-member-init,
-# readability-simplify-boolean-expr,
+#


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137804.476740.patch
Type: text/x-patch
Size: 3386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221120/c343710b/attachment.bin>


More information about the libcxx-commits mailing list