[libcxx-commits] [libcxx] [libc++] Fix naming of value template parameters (PR #76888)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 3 19:21:18 PST 2024


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/76888

None

>From 36913dad001b1f87c8410a9e2950a403be535a3e Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Thu, 4 Jan 2024 04:20:45 +0100
Subject: [PATCH] [libc++] Fix naming of value template parameters

---
 libcxx/.clang-tidy                         | 8 ++++++--
 libcxx/include/__format/format_arg_store.h | 8 ++++----
 libcxx/include/__functional/bind.h         | 4 ++--
 libcxx/include/__mdspan/extents.h          | 6 +++---
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy
index 214661789cd51a..8be3d9724c45c8 100644
--- a/libcxx/.clang-tidy
+++ b/libcxx/.clang-tidy
@@ -56,8 +56,12 @@ CheckOptions:
     value: _
   - key:   readability-identifier-naming.TemplateParameterIgnoredRegexp
     value: (.*\:auto|expr-type) # This is https://llvm.org/PR56464
-  - key:   readability-identifier-naming.ValueTemplateParameterIgnoredRegexp # TODO: enforce naming of variable parameters
-    value: .*
+  - key:   readability-identifier-naming.ValueTemplateParameterCase
+    value: lower_case
+  - key:   readability-identifier-naming.ValueTemplateParameterPrefix
+    value: __
+  - key:   readability-identifier-naming.ValueTemplateParameterIgnoredRegexp
+    value: _[A-Z].* # TODO: Converge on a single style for value template parameters
 
 # TODO: investigate these checks
 # bugprone-branch-clone,
diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index c481992d2d719a..f76bc6d023333e 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -228,15 +228,15 @@ _LIBCPP_HIDE_FROM_ABI void __store_basic_format_arg(basic_format_arg<_Context>*
   ([&] { *__data++ = __format::__create_format_arg<_Context>(__args); }(), ...);
 }
 
-template <class _Context, size_t N>
+template <class _Context, size_t __n>
 struct __packed_format_arg_store {
-  __basic_format_arg_value<_Context> __values_[N];
+  __basic_format_arg_value<_Context> __values_[__n];
   uint64_t __types_ = 0;
 };
 
-template <class _Context, size_t N>
+template <class _Context, size_t __n>
 struct __unpacked_format_arg_store {
-  basic_format_arg<_Context> __args_[N];
+  basic_format_arg<_Context> __args_[__n];
 };
 
 } // namespace __format
diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h
index 19e7d82155ec97..6485cf8d0ca3f6 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -94,7 +94,7 @@ __mu(_Ti& __ti, tuple<_Uj...>& __uj) {
   return std::__mu_expand(__ti, __uj, __indices());
 }
 
-template <bool IsPh, class _Ti, class _Uj>
+template <bool __is_ph, class _Ti, class _Uj>
 struct __mu_return2 {};
 
 template <class _Ti, class _Uj>
@@ -119,7 +119,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Ti& __mu(_Ti& __ti,
   return __ti;
 }
 
-template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh, class _TupleUj>
+template <class _Ti, bool __is_reference_wrapper, bool __is_bind_ex, bool __is_ph, class _TupleUj>
 struct __mu_return_impl;
 
 template <bool _Invokable, class _Ti, class... _Uj>
diff --git a/libcxx/include/__mdspan/extents.h b/libcxx/include/__mdspan/extents.h
index f6bcd940ee6077..f7b50a9a4b2869 100644
--- a/libcxx/include/__mdspan/extents.h
+++ b/libcxx/include/__mdspan/extents.h
@@ -137,9 +137,9 @@ struct __maybe_static_array {
   // static mapping of indices to the position in the dynamic values array
   using _DynamicIdxMap = __static_partial_sums<static_cast<size_t>(_Values == _DynTag)...>;
 
-  template <size_t... Indices>
-  _LIBCPP_HIDE_FROM_ABI static constexpr _DynamicValues __zeros(index_sequence<Indices...>) noexcept {
-    return _DynamicValues{((void)Indices, 0)...};
+  template <size_t... __indices>
+  _LIBCPP_HIDE_FROM_ABI static constexpr _DynamicValues __zeros(index_sequence<__indices...>) noexcept {
+    return _DynamicValues{((void)__indices, 0)...};
   }
 
 public:



More information about the libcxx-commits mailing list