https://github.com/smallp-o-p updated 
https://github.com/llvm/llvm-project/pull/179590

>From 1d4955a0bd3d2efe76c1735e03bf10e3ab46fcf4 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <[email protected]>
Date: Tue, 3 Feb 2026 20:46:58 -0500
Subject: [PATCH 1/5] Make comparison operators hidden friends

---
 libcxx/include/__iterator/wrap_iter.h | 192 +++++++++++++-------------
 1 file changed, 93 insertions(+), 99 deletions(-)

diff --git a/libcxx/include/__iterator/wrap_iter.h 
b/libcxx/include/__iterator/wrap_iter.h
index 128aeab3ac7cd..ab5b0d2b6f706 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -119,117 +119,111 @@ class __wrap_iter {
   friend struct array;
   template <class _Tp, class>
   friend struct __optional_iterator;
-};
 
-template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) 
_NOEXCEPT {
-  return __x.base() == __y.base();
-}
-
-template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) 
_NOEXCEPT {
-  return __x.base() == __y.base();
-}
-
-template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) 
_NOEXCEPT {
-  return __x.base() < __y.base();
-}
-
-template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) 
_NOEXCEPT {
-  return __x.base() < __y.base();
-}
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator==(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
+    return __x.base() == __y.base();
+  }
+
+  template <class _Iter2>
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator==(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 
{
+    return __x.base() == __y.base();
+  }
+
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+  operator<(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
+    return __x.base() < __y.base();
+  }
+
+  template <class _Iter2>
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
+  operator<(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+    return __x.base() < __y.base();
+  }
 
 #if _LIBCPP_STD_VER <= 17
-template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter<_Iter1>& __x, const 
__wrap_iter<_Iter1>& __y) _NOEXCEPT {
-  return !(__x == __y);
-}
-
-template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) 
_NOEXCEPT {
-  return !(__x == __y);
-}
-template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) 
_NOEXCEPT {
-  return __y < __x;
-}
-
-template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) 
_NOEXCEPT {
-  return __y < __x;
-}
-
-template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) 
_NOEXCEPT {
-  return !(__x < __y);
-}
-
-template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) 
_NOEXCEPT {
-  return !(__x < __y);
-}
-
-template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) 
_NOEXCEPT {
-  return !(__y < __x);
-}
-
-template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) 
_NOEXCEPT {
-  return !(__y < __x);
-}
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator!=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
+    return !(__x == __y);
+  }
 
-#else
-template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
-operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) 
noexcept {
-  if constexpr (three_way_comparable_with<_Iter1, _Iter2, strong_ordering>) {
-    return __x.base() <=> __y.base();
-  } else {
-    if (__x.base() < __y.base())
-      return strong_ordering::less;
+  template <class _Iter2>
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator!=(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 
{
+    return !(__x == __y);
+  }
 
-    if (__x.base() == __y.base())
-      return strong_ordering::equal;
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator>(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
+    return __y < __x;
+  }
+
+  template <class _Iter2>
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator>(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
+    return __y < __x;
+  }
 
-    return strong_ordering::greater;
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator>=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
+    return !(__x < __y);
+  }
+
+  template <class _Iter2>
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator>=(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 
{
+    return !(__x < __y);
+  }
+
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator<=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
+    return !(__y < __x);
+  }
+
+  template <class _Iter2>
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
+  operator<=(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 
{
+    return !(__y < __x);
+  }
+
+#else
+  template <class _Iter2>
+  _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
+  operator<=>(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) noexcept 
{
+    if constexpr (three_way_comparable_with<_Iter, _Iter2, strong_ordering>) {
+      return __x.base() <=> __y.base();
+    } else {
+      if (__x.base() < __y.base())
+        return strong_ordering::less;
+
+      if (__x.base() == __y.base())
+        return strong_ordering::equal;
+
+      return strong_ordering::greater;
+    }
   }
-}
 #endif // _LIBCPP_STD_VER >= 20
 
-template <class _Iter1, class _Iter2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
 #ifndef _LIBCPP_CXX03_LANG
-auto operator-(const __wrap_iter<_Iter1>& __x,
-               const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.base() 
- __y.base())
+  template <class _Iter2>
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 auto
+  operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) 
_NOEXCEPT->decltype(__x.base() - __y.base())
 #else
-typename __wrap_iter<_Iter1>::difference_type
-operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) 
_NOEXCEPT
+  template <class _Iter2>
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename 
__wrap_iter::difference_type
+  operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 #endif // C++03
-{
-  return __x.base() - __y.base();
-}
-
-template <class _Iter1>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter<_Iter1>
-operator+(typename __wrap_iter<_Iter1>::difference_type __n, 
__wrap_iter<_Iter1> __x) _NOEXCEPT {
-  __x += __n;
-  return __x;
-}
+  {
+    return __x.base() - __y.base();
+  }
+
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter
+  operator+(typename __wrap_iter::difference_type __n, __wrap_iter __x) 
_NOEXCEPT {
+    __x += __n;
+    return __x;
+  }
+};
 
 #if _LIBCPP_STD_VER <= 17
 template <class _It>

>From 0d64ab591e37e213a5767f4a72c412bf3d7120bb Mon Sep 17 00:00:00 2001
From: William Tran-Viet <[email protected]>
Date: Tue, 3 Feb 2026 20:54:29 -0500
Subject: [PATCH 2/5] Formatting

---
 libcxx/include/__iterator/wrap_iter.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libcxx/include/__iterator/wrap_iter.h 
b/libcxx/include/__iterator/wrap_iter.h
index ab5b0d2b6f706..234c9a4f8c704 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -143,8 +143,8 @@ class __wrap_iter {
   }
 
 #if _LIBCPP_STD_VER <= 17
-  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
-  operator!=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
+  _LIBCPP_HIDE_FROM_ABI friend
+      _LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter& __x, const 
__wrap_iter& __y) _NOEXCEPT {
     return !(__x == __y);
   }
 
@@ -211,8 +211,8 @@ class __wrap_iter {
   operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) 
_NOEXCEPT->decltype(__x.base() - __y.base())
 #else
   template <class _Iter2>
-  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename 
__wrap_iter::difference_type
-  operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+  _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14
+  typename __wrap_iter::difference_type operator-(const __wrap_iter& __x, 
const __wrap_iter<_Iter2>& __y) _NOEXCEPT
 #endif // C++03
   {
     return __x.base() - __y.base();

>From 65b0fda313d8d0a3d8aa767bd93d3317ebaa1ef3 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <[email protected]>
Date: Thu, 12 Feb 2026 22:27:49 -0500
Subject: [PATCH 3/5] ci


>From 3fdbd9fda69eb1b7bc67d200827fbd85aaacb407 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <[email protected]>
Date: Mon, 16 Feb 2026 19:57:49 -0500
Subject: [PATCH 4/5] Skip failing lldb test case

---
 .../import-std-module/iterator/TestIteratorFromStdModule.py    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py
index 370c3674faeca..727a3e397eea3 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py
@@ -9,8 +9,7 @@
 
 class TestCase(TestBase):
     @add_test_categories(["libc++"])
-    @skipIf(compiler=no_match("clang"))
-    @skipIf(macos_version=["<", "15.0"])
+    @skipIf
     def test(self):
         self.build()
 

>From 360f826a89f6be296fa941464b169581dee39d19 Mon Sep 17 00:00:00 2001
From: William Tran-Viet <[email protected]>
Date: Mon, 16 Feb 2026 23:57:23 -0500
Subject: [PATCH 5/5] Did wrong thing

---
 .../iterator/TestIteratorFromStdModule.py            | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git 
a/lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py
index 727a3e397eea3..1ff9236ca3a05 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py
@@ -9,8 +9,9 @@
 
 class TestCase(TestBase):
     @add_test_categories(["libc++"])
-    @skipIf
-    def test(self):
+    @skipIf(compiler=no_match("clang"))
+    
@expectedFailureAll(bugnumber="https://github.com/llvm/llvm-project/issues/149477";)
+    def test_xfail(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(
@@ -19,13 +20,6 @@ def test(self):
 
         self.runCmd("settings set target.import-std-module true")
 
-        iter_type = "std::move_iterator<std::__wrap_iter<int *> >"
-
-        self.expect_expr("move_begin", result_type=iter_type)
-        self.expect_expr("move_begin[0]", result_type="int", result_value="1")
-
-        self.expect_expr("move_begin + 3 == move_end", result_value="true")
-
         self.expect("expr move_begin++")
         self.expect_expr("move_begin + 2 == move_end", result_value="true")
         self.expect("expr move_begin--")

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to