Skip to content

Conversation

@Sh0g0-1758
Copy link
Member

@Sh0g0-1758 Sh0g0-1758 commented Oct 10, 2024

We have two (EDIT: 4) files in which we are using I. This PR replaces them with alternatives like i and IDX etc.

@llvmbot llvmbot added the libc label Oct 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 10, 2024

@llvm/pr-subscribers-libc

Author: Shourya Goel (Sh0g0-1758)

Changes

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 --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

@Sh0g0-1758
Copy link
Member Author

can we merge this ? Would be required for #111659

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, do you need me to merge this for you?

@github-actions
Copy link

github-actions bot commented Oct 10, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@Sh0g0-1758
Copy link
Member Author

@michaelrj-google there were two more files for which I changed the type I to InType and OutType. If that also looks good, then please merge.

@Sh0g0-1758 Sh0g0-1758 force-pushed the libc_fix_for_macro_I branch from 7e4d47c to 1d2fe2f Compare October 11, 2024 17:37
@lntue lntue merged commit 111b062 into llvm:main Oct 11, 2024
7 checks passed
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
We have two (EDIT: 4) files in which we are using `I`. This PR replaces
them with alternatives like `i` and `IDX` etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants