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

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


https://github.com/Sh0g0-1758 created https://github.com/llvm/llvm-project/pull/111872

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

>From 357833beaf32bb55178b80b95ab5d7be7ca6f104 Mon Sep 17 00:00:00 2001
From: Sh0g0-1758 <shouryagoel10000 at gmail.com>
Date: Thu, 10 Oct 2024 22:28:54 +0530
Subject: [PATCH] fix

---
 libc/src/__support/CPP/string_view.h      | 4 ++--
 libc/src/__support/CPP/utility/in_place.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

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



More information about the libc-commits mailing list