[libc-commits] [libc] [libc] Fix for adding macro I (PR #111872)

via libc-commits libc-commits at lists.llvm.org
Thu Oct 10 10:01:46 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Shourya Goel (Sh0g0-1758)

<details>
<summary>Changes</summary>

We have two files in which we are using `I`. This PR replaces them with alternatives like `i` and `IDX`

---
Full diff: https://github.com/llvm/llvm-project/pull/111872.diff


2 Files Affected:

- (modified) libc/src/__support/CPP/string_view.h (+2-2) 
- (modified) libc/src/__support/CPP/utility/in_place.h (+3-3) 


``````````diff
diff --git a/libc/src/__support/CPP/string_view.h b/libc/src/__support/CPP/string_view.h
index 88f5270c3170a3..745c62c35f0a0a 100644
--- a/libc/src/__support/CPP/string_view.h
+++ b/libc/src/__support/CPP/string_view.h
@@ -31,8 +31,8 @@ class string_view {
 
   LIBC_INLINE static int compareMemory(const char *Lhs, const char *Rhs,
                                        size_t Length) {
-    for (size_t I = 0; I < Length; ++I)
-      if (int Diff = (int)Lhs[I] - (int)Rhs[I])
+    for (size_t i = 0; i < Length; ++i)
+      if (int Diff = (int)Lhs[i] - (int)Rhs[i])
         return Diff;
     return 0;
   }
diff --git a/libc/src/__support/CPP/utility/in_place.h b/libc/src/__support/CPP/utility/in_place.h
index b5411f247d5519..3967eb1c535e45 100644
--- a/libc/src/__support/CPP/utility/in_place.h
+++ b/libc/src/__support/CPP/utility/in_place.h
@@ -27,11 +27,11 @@ template <class T> struct in_place_type_t {
 };
 template <class T> LIBC_INLINE_VAR constexpr in_place_type_t<T> in_place_type{};
 
-template <size_t I> struct in_place_index_t {
+template <size_t IDX> struct in_place_index_t {
   LIBC_INLINE explicit in_place_index_t() = default;
 };
-template <size_t I>
-LIBC_INLINE_VAR constexpr in_place_index_t<I> in_place_index{};
+template <size_t IDX>
+LIBC_INLINE_VAR constexpr in_place_index_t<IDX> in_place_index{};
 
 } // namespace cpp
 } // namespace LIBC_NAMESPACE_DECL

``````````

</details>


https://github.com/llvm/llvm-project/pull/111872


More information about the libc-commits mailing list