[libcxx-commits] [libcxx] 01df675 - [libc++] Enable modernize-loop-convert

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 18 12:34:25 PDT 2022


Author: Nikolas Klauser
Date: 2022-03-18T20:34:19+01:00
New Revision: 01df675191decf129bf76e240659a06477f4bfe9

URL: https://github.com/llvm/llvm-project/commit/01df675191decf129bf76e240659a06477f4bfe9
DIFF: https://github.com/llvm/llvm-project/commit/01df675191decf129bf76e240659a06477f4bfe9.diff

LOG: [libc++] Enable modernize-loop-convert

Reviewed By: ldionne, Mordante, #libc

Spies: var-const, aheejin, libcxx-commits

Differential Revision: https://reviews.llvm.org/D121216

Added: 
    

Modified: 
    libcxx/.clang-tidy
    libcxx/include/locale

Removed: 
    


################################################################################
diff  --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy
index 45adea9b1b153..20a0bb8012b37 100644
--- a/libcxx/.clang-tidy
+++ b/libcxx/.clang-tidy
@@ -10,6 +10,7 @@ Checks: >
 
   -misc-unconventional-assign-operator,
 
+  modernize-loop-convert,
   modernize-redundant-void-arg,
 
   readability-duplicate-include,
@@ -33,7 +34,6 @@ CheckOptions:
 # bugprone-branch-clone,
 # bugprone-macro-parentheses,
 # cppcoreguidelines-prefer-member-initializer,
-# modernize-loop-convert,
 # modernize-use-bool-literals,
 # modernize-use-default-member-init,
 # modernize-use-equals-default,

diff  --git a/libcxx/include/locale b/libcxx/include/locale
index fd605e320a681..067c146d8234d 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -3221,9 +3221,9 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
                               int __fd)
 {
     __me = __mb;
-    for (unsigned __p = 0; __p < 4; ++__p)
+    for (char __p : __pat.field)
     {
-        switch (__pat.field[__p])
+        switch (__p)
         {
         case money_base::none:
             __mi = __me;


        


More information about the libcxx-commits mailing list