Skip to content

[libc++] Backport segmented iterator optimization for std::for_each to C++11 #134960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 19, 2025

Conversation

winner245
Copy link
Contributor

@winner245 winner245 commented Apr 9, 2025

Previously, the segmented iterator optimization for std::for_each was restricted to C++23 and later due to its dependency on __movable_box, which is not available in earlier standards. This patch eliminates that restriction, enabling consistent optimizations starting from C++11.

By backporting this enhancement, we improve performance across older standards and create opportunities to extend similar optimizations to other algorithms by forwarding their calls to std::for_each.

Copy link

github-actions bot commented Apr 10, 2025

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

@winner245 winner245 changed the title [libc++] Backport segmented iterator optimization for std::for_each to C++03 [libc++] Backport segmented iterator optimization for std::for_each to C++11 Apr 10, 2025
@winner245 winner245 marked this pull request as ready for review April 10, 2025 21:43
@winner245 winner245 requested a review from a team as a code owner April 10, 2025 21:43
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Apr 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 10, 2025

@llvm/pr-subscribers-libcxx

Author: Peng Liu (winner245)

Changes

Previously, the segmented iterator optimization for std::for_each was restricted to C++23 and later due to its dependency on __movable_box, which is not available in earlier standards. This patch eliminates that restriction, enabling consistent optimizations starting from C++11.

By backporting this enhancement, we improve performance across older standards and create opportunities to extend similar optimizations to other algorithms by forwarding their calls to std::for_each.


Patch is 28.62 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/134960.diff

14 Files Affected:

  • (modified) libcxx/include/__algorithm/for_each.h (+22-18)
  • (modified) libcxx/include/algorithm (+1)
  • (modified) libcxx/include/array (+1)
  • (modified) libcxx/include/bitset (+1)
  • (modified) libcxx/include/codecvt (+1)
  • (modified) libcxx/include/condition_variable (+1)
  • (modified) libcxx/include/ios (+1)
  • (modified) libcxx/include/locale (+1)
  • (modified) libcxx/include/streambuf (+1)
  • (modified) libcxx/include/string (+1)
  • (modified) libcxx/include/string_view (+1)
  • (modified) libcxx/include/system_error (+1)
  • (modified) libcxx/include/vector (+1)
  • (modified) libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp (+242-139)
diff --git a/libcxx/include/__algorithm/for_each.h b/libcxx/include/__algorithm/for_each.h
index e08f583504c01..ad021dd962ee5 100644
--- a/libcxx/include/__algorithm/for_each.h
+++ b/libcxx/include/__algorithm/for_each.h
@@ -13,7 +13,7 @@
 #include <__algorithm/for_each_segment.h>
 #include <__config>
 #include <__iterator/segmented_iterator.h>
-#include <__ranges/movable_box.h>
+#include <__type_traits/enable_if.h>
 #include <__utility/in_place.h>
 #include <__utility/move.h>
 
@@ -26,28 +26,32 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _InputIterator, class _Function>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Function
-for_each(_InputIterator __first, _InputIterator __last, _Function __f) {
+template <class _InputIterator, class _Sent, class _Func>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __for_each(_InputIterator __first, _Sent __last, _Func& __f) {
   for (; __first != __last; ++__first)
     __f(*__first);
-  return __f;
 }
 
-// __movable_box is available in C++20, but is actually a copyable-box, so optimization is only correct in C++23
-#if _LIBCPP_STD_VER >= 23
-template <class _SegmentedIterator, class _Function>
-  requires __is_segmented_iterator<_SegmentedIterator>::value
-_LIBCPP_HIDE_FROM_ABI constexpr _Function
-for_each(_SegmentedIterator __first, _SegmentedIterator __last, _Function __func) {
-  ranges::__movable_box<_Function> __wrapped_func(in_place, std::move(__func));
-  std::__for_each_segment(__first, __last, [&](auto __lfirst, auto __llast) {
-    __wrapped_func =
-        ranges::__movable_box<_Function>(in_place, std::for_each(__lfirst, __llast, std::move(*__wrapped_func)));
-  });
-  return std::move(*__wrapped_func);
+#ifndef _LIBCPP_CXX03_LANG
+template <class _SegmentedIterator,
+          class _Function,
+          __enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__for_each(_SegmentedIterator __first, _SegmentedIterator __last, _Function& __func) {
+  using _Traits = __segmented_iterator_traits<_SegmentedIterator>;
+  std::__for_each_segment(
+      __first, __last, [&](typename _Traits::__local_iterator __lfirst, typename _Traits::__local_iterator __llast) {
+        std::__for_each(__lfirst, __llast, __func);
+      });
+}
+#endif
+
+template <class _InputIterator, class _Function>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Function
+for_each(_InputIterator __first, _InputIterator __last, _Function __f) {
+  std::__for_each(__first, __last, __f);
+  return __f;
 }
-#endif // _LIBCPP_STD_VER >= 23
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index bf67d3363a595..64e9fa6306145 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -2061,6 +2061,7 @@ template <class BidirectionalIterator, class Compare>
 #    include <cstring>
 #    include <iterator>
 #    include <memory>
+#    include <optional>
 #    include <stdexcept>
 #    include <type_traits>
 #    include <utility>
diff --git a/libcxx/include/array b/libcxx/include/array
index 6e3a1d82abb1b..ff46838e2e8e2 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -566,6 +566,7 @@ _LIBCPP_POP_MACROS
 #    include <cstdlib>
 #    include <iterator>
 #    include <new>
+#    include <optional>
 #    include <type_traits>
 #    include <utility>
 #  endif
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index c403c533db7e9..9273ccabbb4e3 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -973,6 +973,7 @@ _LIBCPP_POP_MACROS
 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #    include <concepts>
 #    include <cstdlib>
+#    include <optional>
 #    include <type_traits>
 #  endif
 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
diff --git a/libcxx/include/codecvt b/libcxx/include/codecvt
index 9f241b734d694..33ade1d298a7e 100644
--- a/libcxx/include/codecvt
+++ b/libcxx/include/codecvt
@@ -596,6 +596,7 @@ _LIBCPP_END_NAMESPACE_STD
 #    include <limits>
 #    include <mutex>
 #    include <new>
+#    include <optional>
 #    include <stdexcept>
 #    include <type_traits>
 #    include <typeinfo>
diff --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable
index 7f44990547f55..99c74b02807ae 100644
--- a/libcxx/include/condition_variable
+++ b/libcxx/include/condition_variable
@@ -357,6 +357,7 @@ _LIBCPP_POP_MACROS
 #    include <initializer_list>
 #    include <iosfwd>
 #    include <new>
+#    include <optional>
 #    include <stdexcept>
 #    include <system_error>
 #    include <type_traits>
diff --git a/libcxx/include/ios b/libcxx/include/ios
index 9d2968753c507..9e48ec88ce59d 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -887,6 +887,7 @@ _LIBCPP_POP_MACROS
 #    include <limits>
 #    include <mutex>
 #    include <new>
+#    include <optional>
 #    include <stdexcept>
 #    include <system_error>
 #    include <type_traits>
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 8e07b8be9ce0d..40f9dd2608fb6 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -3666,6 +3666,7 @@ _LIBCPP_POP_MACROS
 #    include <cstdarg>
 #    include <iterator>
 #    include <mutex>
+#    include <optional>
 #    include <stdexcept>
 #    include <type_traits>
 #    include <typeinfo>
diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf
index eed7eb4d75ecb..85f3af1b88ae7 100644
--- a/libcxx/include/streambuf
+++ b/libcxx/include/streambuf
@@ -386,6 +386,7 @@ _LIBCPP_POP_MACROS
 
 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #    include <cstdint>
+#    include <optional>
 #  endif
 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
 
diff --git a/libcxx/include/string b/libcxx/include/string
index e7e541e31432d..f3f97655d79ea 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -4027,6 +4027,7 @@ _LIBCPP_POP_MACROS
 #    include <cstdlib>
 #    include <iterator>
 #    include <new>
+#    include <optional>
 #    include <type_traits>
 #    include <typeinfo>
 #    include <utility>
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 5054b14efd2d5..861187c0640e1 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -952,6 +952,7 @@ _LIBCPP_POP_MACROS
 #    include <concepts>
 #    include <cstdlib>
 #    include <iterator>
+#    include <optional>
 #    include <type_traits>
 #  endif
 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
diff --git a/libcxx/include/system_error b/libcxx/include/system_error
index 4dadc0a6ab483..2b668e5f8f1bc 100644
--- a/libcxx/include/system_error
+++ b/libcxx/include/system_error
@@ -168,6 +168,7 @@ template <> struct hash<std::error_condition>;
 #    include <cstdint>
 #    include <cstring>
 #    include <limits>
+#    include <optional>
 #    include <type_traits>
 #  endif
 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 9fa81dcb7e76e..d2d5fcf4a3199 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -362,6 +362,7 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
 #    if _LIBCPP_HAS_LOCALIZATION
 #      include <locale>
 #    endif
+#    include <optional>
 #    include <string>
 #    include <string_view>
 #    include <tuple>
diff --git a/libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp b/libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp
index df656f296bd05..256251686bb3e 100644
--- a/libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp
@@ -12,209 +12,312 @@
 #include <cassert>
 #include <compare>
 #include <cstddef>
+#include <deque>
+#include <ranges>
 #include <type_traits>
+#include <vector>
 
 #include "test_macros.h"
 
 template <class T>
 struct Less {
-    int *copies_;
-    TEST_CONSTEXPR explicit Less(int *copies) : copies_(copies) {}
-    TEST_CONSTEXPR_CXX14 Less(const Less& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
-    TEST_CONSTEXPR_CXX14 Less& operator=(const Less&) = default;
-    TEST_CONSTEXPR bool operator()(T, T) const { return false; }
+  int* copies_;
+  TEST_CONSTEXPR explicit Less(int* copies) : copies_(copies) {}
+  TEST_CONSTEXPR_CXX14 Less(const Less& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+  TEST_CONSTEXPR_CXX14 Less& operator=(const Less&) = default;
+  TEST_CONSTEXPR bool operator()(T, T) const { return false; }
 };
 
 template <class T>
 struct Equal {
-    int *copies_;
-    TEST_CONSTEXPR explicit Equal(int *copies) : copies_(copies) {}
-    TEST_CONSTEXPR_CXX14 Equal(const Equal& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
-    TEST_CONSTEXPR_CXX14 Equal& operator=(const Equal&) = default;
-    TEST_CONSTEXPR bool operator()(T, T) const { return true; }
+  int* copies_;
+  TEST_CONSTEXPR explicit Equal(int* copies) : copies_(copies) {}
+  TEST_CONSTEXPR_CXX14 Equal(const Equal& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+  TEST_CONSTEXPR_CXX14 Equal& operator=(const Equal&) = default;
+  TEST_CONSTEXPR bool operator()(T, T) const { return true; }
 };
 
 template <class T>
 struct UnaryVoid {
-    int *copies_;
-    TEST_CONSTEXPR explicit UnaryVoid(int *copies) : copies_(copies) {}
-    TEST_CONSTEXPR_CXX14 UnaryVoid(const UnaryVoid& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
-    TEST_CONSTEXPR_CXX14 UnaryVoid& operator=(const UnaryVoid&) = default;
-    TEST_CONSTEXPR_CXX14 void operator()(T) const {}
+  int* copies_;
+  TEST_CONSTEXPR explicit UnaryVoid(int* copies) : copies_(copies) {}
+  TEST_CONSTEXPR_CXX14 UnaryVoid(const UnaryVoid& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+  TEST_CONSTEXPR_CXX14 UnaryVoid& operator=(const UnaryVoid&) = default;
+  TEST_CONSTEXPR_CXX14 void operator()(T) const {}
 };
 
 template <class T>
 struct UnaryTrue {
-    int *copies_;
-    TEST_CONSTEXPR explicit UnaryTrue(int *copies) : copies_(copies) {}
-    TEST_CONSTEXPR_CXX14 UnaryTrue(const UnaryTrue& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
-    TEST_CONSTEXPR_CXX14 UnaryTrue& operator=(const UnaryTrue&) = default;
-    TEST_CONSTEXPR bool operator()(T) const { return true; }
+  int* copies_;
+  TEST_CONSTEXPR explicit UnaryTrue(int* copies) : copies_(copies) {}
+  TEST_CONSTEXPR_CXX14 UnaryTrue(const UnaryTrue& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+  TEST_CONSTEXPR_CXX14 UnaryTrue& operator=(const UnaryTrue&) = default;
+  TEST_CONSTEXPR bool operator()(T) const { return true; }
 };
 
 template <class T>
 struct NullaryValue {
-    int *copies_;
-    TEST_CONSTEXPR explicit NullaryValue(int *copies) : copies_(copies) {}
-    TEST_CONSTEXPR_CXX14 NullaryValue(const NullaryValue& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
-    TEST_CONSTEXPR_CXX14 NullaryValue& operator=(const NullaryValue&) = default;
-    TEST_CONSTEXPR T operator()() const { return 0; }
+  int* copies_;
+  TEST_CONSTEXPR explicit NullaryValue(int* copies) : copies_(copies) {}
+  TEST_CONSTEXPR_CXX14 NullaryValue(const NullaryValue& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+  TEST_CONSTEXPR_CXX14 NullaryValue& operator=(const NullaryValue&) = default;
+  TEST_CONSTEXPR T operator()() const { return 0; }
 };
 
 template <class T>
 struct UnaryTransform {
-    int *copies_;
-    TEST_CONSTEXPR explicit UnaryTransform(int *copies) : copies_(copies) {}
-    TEST_CONSTEXPR_CXX14 UnaryTransform(const UnaryTransform& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
-    TEST_CONSTEXPR_CXX14 UnaryTransform& operator=(const UnaryTransform&) = default;
-    TEST_CONSTEXPR T operator()(T) const { return 0; }
+  int* copies_;
+  TEST_CONSTEXPR explicit UnaryTransform(int* copies) : copies_(copies) {}
+  TEST_CONSTEXPR_CXX14 UnaryTransform(const UnaryTransform& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+  TEST_CONSTEXPR_CXX14 UnaryTransform& operator=(const UnaryTransform&) = default;
+  TEST_CONSTEXPR T operator()(T) const { return 0; }
 };
 
 template <class T>
 struct BinaryTransform {
-    int *copies_;
-    TEST_CONSTEXPR explicit BinaryTransform(int *copies) : copies_(copies) {}
-    TEST_CONSTEXPR_CXX14 BinaryTransform(const BinaryTransform& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
-    TEST_CONSTEXPR_CXX14 BinaryTransform& operator=(const BinaryTransform&) = default;
-    TEST_CONSTEXPR T operator()(T, T) const { return 0; }
+  int* copies_;
+  TEST_CONSTEXPR explicit BinaryTransform(int* copies) : copies_(copies) {}
+  TEST_CONSTEXPR_CXX14 BinaryTransform(const BinaryTransform& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+  TEST_CONSTEXPR_CXX14 BinaryTransform& operator=(const BinaryTransform&) = default;
+  TEST_CONSTEXPR T operator()(T, T) const { return 0; }
 };
 
 #if TEST_STD_VER > 17
 template <class T>
 struct ThreeWay {
-    int *copies_;
-    constexpr explicit ThreeWay(int *copies) : copies_(copies) {}
-    constexpr ThreeWay(const ThreeWay& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
-    constexpr ThreeWay& operator=(const ThreeWay&) = default;
-    constexpr std::strong_ordering operator()(T, T) const { return std::strong_ordering::equal; }
+  int* copies_;
+  constexpr explicit ThreeWay(int* copies) : copies_(copies) {}
+  constexpr ThreeWay(const ThreeWay& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+  constexpr ThreeWay& operator=(const ThreeWay&) = default;
+  constexpr std::strong_ordering operator()(T, T) const { return std::strong_ordering::equal; }
 };
 #endif
 
 template <class T>
-TEST_CONSTEXPR_CXX20 bool all_the_algorithms()
-{
-    T a[10] = {};
-    T b[10] = {};
-    T *first = a;
-    T *mid = a+5;
-    T *last = a+10;
-    T *first2 = b;
-    T *mid2 = b+5;
-    T *last2 = b+10;
-    T value = 0;
-    int count = 1;
-
-    int copies = 0;
-    (void)std::adjacent_find(first, last, Equal<T>(&copies)); assert(copies == 0);
+TEST_CONSTEXPR_CXX20 bool all_the_algorithms() {
+  T a[10]   = {};
+  T b[10]   = {};
+  T* first  = a;
+  T* mid    = a + 5;
+  T* last   = a + 10;
+  T* first2 = b;
+  T* mid2   = b + 5;
+  T* last2  = b + 10;
+  T value   = 0;
+  int count = 1;
+
+  int copies = 0;
+  (void)std::adjacent_find(first, last, Equal<T>(&copies));
+  assert(copies == 0);
 #if TEST_STD_VER >= 11
-    (void)std::all_of(first, last, UnaryTrue<T>(&copies)); assert(copies == 0);
-    (void)std::any_of(first, last, UnaryTrue<T>(&copies)); assert(copies == 0);
+  (void)std::all_of(first, last, UnaryTrue<T>(&copies));
+  assert(copies == 0);
+  (void)std::any_of(first, last, UnaryTrue<T>(&copies));
+  assert(copies == 0);
 #endif
-    (void)std::binary_search(first, last, value, Less<T>(&copies)); assert(copies == 0);
+  (void)std::binary_search(first, last, value, Less<T>(&copies));
+  assert(copies == 0);
 #if TEST_STD_VER > 17
-    (void)std::clamp(value, value, value, Less<T>(&copies)); assert(copies == 0);
+  (void)std::clamp(value, value, value, Less<T>(&copies));
+  assert(copies == 0);
 #endif
-    (void)std::count_if(first, last, UnaryTrue<T>(&copies)); assert(copies == 0);
-    (void)std::copy_if(first, last, first2, UnaryTrue<T>(&copies)); assert(copies == 0);
-    (void)std::equal(first, last, first2, Equal<T>(&copies)); assert(copies == 0);
+  (void)std::count_if(first, last, UnaryTrue<T>(&copies));
+  assert(copies == 0);
+  (void)std::copy_if(first, last, first2, UnaryTrue<T>(&copies));
+  assert(copies == 0);
+  (void)std::equal(first, last, first2, Equal<T>(&copies));
+  assert(copies == 0);
 #if TEST_STD_VER > 11
-    (void)std::equal(first, last, first2, last2, Equal<T>(&copies)); assert(copies == 0);
+  (void)std::equal(first, last, first2, last2, Equal<T>(&copies));
+  assert(copies == 0);
 #endif
-    (void)std::equal_range(first, last, value, Less<T>(&copies)); assert(copies == 0);
-    (void)std::find_end(first, last, first2, mid2, Equal<T>(&copies)); assert(copies == 0);
-    (void)std::find_first_of(first, last, first2, last2, Equal<T>(&copies)); assert(copies == 0);
-    (void)std::find_if(first, last, UnaryTrue<T>(&copies)); assert(copies == 0);
-    (void)std::find_if_not(first, last, UnaryTrue<T>(&copies)); assert(copies == 0);
-    (void)std::for_each(first, last, UnaryVoid<T>(&copies)); assert(copies == 1); copies = 0;
+  (void)std::equal_range(first, last, value, Less<T>(&copies));
+  assert(copies == 0);
+  (void)std::find_end(first, last, first2, mid2, Equal<T>(&copies));
+  assert(copies == 0);
+  (void)std::find_first_of(first, last, first2, last2, Equal<T>(&copies));
+  assert(copies == 0);
+  (void)std::find_if(first, last, UnaryTrue<T>(&copies));
+  assert(copies == 0);
+  (void)std::find_if_not(first, last, UnaryTrue<T>(&copies));
+  assert(copies == 0);
+  (void)std::for_each(first, last, UnaryVoid<T>(&copies));
+  assert(copies == 1);
+  copies = 0;
 #if TEST_STD_VER > 14
-    (void)std::for_each_n(first, count, UnaryVoid<T>(&copies)); assert(copies == 0);
+  (void)std::for_each_n(first, count, UnaryVoid<T>(&copies));
+  assert(copies == 0);
 #endif
-    (void)std::generate(first, last, NullaryValue<T>(&copies)); assert(copies == 0);
-    (void)std::generate_n(first, count, NullaryValue<T>(&copies)); assert(copies == 0);
-    (void)std::includes(first, last, first2, last2, Less<T>(&copies)); assert(copies == 0);
-    (void)std::is_heap(first, last, Less<T>(&copies)); assert(copies == 0);
-    (void)std::is_heap_until(first, last, Less<T>(&copies)); assert(copies == 0);
-    (void)std::is_partitioned(first, last, UnaryTrue<T>(&copies)); assert(copies == 0);
-    (void)std::is_permutation(first, last, first2, Equal<T>(&copies)); assert(copies == 0);
+  (void)std::generate(first, last, NullaryValue<T>(&copies));
+  assert(copies == 0);
+  (void)std::generate_n(first, count, NullaryValue<T>(&copies));
+  assert(copies == 0);
+  (void)std::includes(first, last, first2, last2, Less<T>(&copies));
+  assert(copies == 0);
+  (void)std::is_heap(first, last, Less<T>(&copies));
+  assert(copies == 0);
+  (void)std::is_heap_until(first, last, Less<T>(&copies));
+  assert(copies == 0);
+  (void)std::is_partitioned(first, last, UnaryTrue<T>(&copies));
+  assert(copies == 0);
+  (void)std::is_permutation(first, last, first2, Equal<T>(&copies));
+  assert(copies == 0);
 #if TEST_STD_VER > 11
-    (void)std::is_permutation(first, last, first2, last2, Equal<T>(&copies)); assert(copies == 0);
+  (void)std::is_permutation(first, last, first2, last2, Equal<T>(&copies));
+  assert(copies == 0);
 #endif
-    (void)std::is_sorted(first, last, Less<T>(&copies)); assert(copies == 0);
-    (void)std::is_sorted_until(first, last, Less<T>(&copies)); assert(copies == 0);
-    if (!TEST_IS_CONSTANT_EVALUATED) { (void)std::inplace_merge(first, mid, last, Less<T>(&copies)); assert(copies == 0); }
-    (void)std::lexicographical_compare(first, last, first2, last2, Less<T>(&copies)); assert(copies == 0);
+  (void)std::is_sorted(first, last, Less<T>(&copies));
+  assert(copies == 0);
+  (void)std::is_sorted_until(first, last, Less<T>(&copies));
+  assert(copies == 0);
+  if (!TEST_IS_CONSTANT_EVALUATED) {
+    (void)std::inplace_merge(first, mid, last, Less<T>(&copies));
+    assert(copies == 0);
+  }
+  (void)std::lexicographical_compare(first, last, first2, last2, Less<T>(&copies));
+  assert(copies == 0);
 #if TEST_STD_VER > 17
-    (void)std::lexicographical_compare_three_way(first, last, first2, last2, ThreeWay<T>(&copies)); assert(copies == 0);
+  (void)std::lexicographical_compare_three_way(first, last, first2, last2, ThreeWay<T>(&copies));
+  assert(copies == 0);
 #endif
-    (void)std::lower_bound(first, last, value, Less<T>(&copies)); assert(copies == 0);
-    (void)std::make_heap(first, last, Less<T>(&copies)); assert(copies == 0);
-    (void)std::max(value, value, Less<T>(&copies)); assert(copies == 0);
+  (void)std::lower_bound(first, last, value, Less<T>(&copies));
+  assert(copies == 0);
+  (void)std::make_heap(first, last, Less<T>(&copies));
+  assert(copies == 0);
+  (void)std::max(value, value, Less<T>(&copies));
+  assert(copies == 0);
 #if TEST_STD_VER >= 11
-    (void)std::max({ value, value }, Less<T>(&copies)); assert(copies == 0);
+  (void)std::max({value, value}, Less<T>(&copies));
+  assert(copies == 0);
 #endif
-    (void)std::max_element(first, last, L...
[truncated]

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

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

Could you add a release note?

@winner245 winner245 merged commit e9280a1 into llvm:main Apr 19, 2025
83 checks passed
@winner245 winner245 deleted the for-each-cxx03 branch April 19, 2025 11:13
@winner245 winner245 self-assigned this Apr 19, 2025
@shafik
Copy link
Collaborator

shafik commented Apr 23, 2025

Looks like this PR is associated w/ a build issue: #137046

gulfemsavrun added a commit to gulfemsavrun/llvm-project that referenced this pull request Apr 28, 2025
gulfemsavrun added a commit to gulfemsavrun/llvm-project that referenced this pull request Apr 29, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…o C++11 (llvm#134960)

Previously, the segmented iterator optimization for `std::for_each` was restricted to C++23 and later due to its dependency on `__movable_box`, which is not available in earlier standards. This patch eliminates that restriction, enabling consistent optimizations starting from C++11. 

By backporting this enhancement, we improve performance across older standards and create opportunities to extend similar optimizations to other algorithms by forwarding their calls to `std::for_each`.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…o C++11 (llvm#134960)

Previously, the segmented iterator optimization for `std::for_each` was restricted to C++23 and later due to its dependency on `__movable_box`, which is not available in earlier standards. This patch eliminates that restriction, enabling consistent optimizations starting from C++11. 

By backporting this enhancement, we improve performance across older standards and create opportunities to extend similar optimizations to other algorithms by forwarding their calls to `std::for_each`.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…o C++11 (llvm#134960)

Previously, the segmented iterator optimization for `std::for_each` was restricted to C++23 and later due to its dependency on `__movable_box`, which is not available in earlier standards. This patch eliminates that restriction, enabling consistent optimizations starting from C++11. 

By backporting this enhancement, we improve performance across older standards and create opportunities to extend similar optimizations to other algorithms by forwarding their calls to `std::for_each`.
@zyn-li
Copy link

zyn-li commented May 16, 2025

This PR caused the tests failure in lldb

Failed tests:

  1. /llvm-project/lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py
  2. /llvm-project/lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py

Above tests passed on commit f91df0d58df4 [clang][bytecode] Diagnose failed MemberPtrPtr casts differently (#136407)

repro steps:

  1. check out to e9280a1,
  2. build lldb and test-deps in /build/Debug/.../toolchain, (run ninja lldb && ninja lldb && ninja lldb-api-test-deps)
  3. run test: /build/Debug/.../toolchain/bin/llvm-lit -sv .../llvm-project/lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py

Test output


UNSUPPORTED: LLDB (xxxxx/build/Debug/bbbbbb-x86_64/toolchain/bin/clang-x86_64) :: test_dsym (TestIteratorFromStdModule.TestCase) (test case does not fall in any category of interest for this run)
python3.10: kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:2152: Error clang::ASTNodeImporter::ImportDeclContext(DeclContext *, bool): Assertion `ToDC == ToD->getLexicalDeclContext() && ToDC->containsDecl(ToD)' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
  #0 0x00007fdd863540c5 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) kkkkkkkkk/llvm-project/llvm/lib/Support/Unix/Signals.inc:804:11
  #1 0x00007fdd863546d4 PrintStackTraceSignalHandler(void*) kkkkkkkkk/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:1
  #2 0x00007fdd86352129 llvm::sys::RunSignalHandlers() kkkkkkkkk/llvm-project/llvm/lib/Support/Signals.cpp:105:5
  #3 0x00007fdd8635549b SignalHandler(int, siginfo_t*, void*) kkkkkkkkk/llvm-project/llvm/lib/Support/Unix/Signals.inc:418:7
  #4 0x00007fdd9b844560 __restore_rt /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/signal/../sysdeps/unix/sysv/linux/libc_sigaction.c:13:0
  #5 0x00007fdd9b89c993 __pthread_kill_internal /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/nptl/pthread_kill.c:46:37
  #6 0x00007fdd9b89c993 pthread_kill@@GLIBC_2.34 /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/nptl/pthread_kill.c:62:10
  #7 0x00007fdd9b8444ad gsignal /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/signal/../sysdeps/posix/raise.c:27:6
  #8 0x00007fdd9b82c433 abort /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/stdlib/abort.c:81:7
  #9 0x00007fdd9b83bc28 __assert_fail_base /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/assert/assert.c:89:7
 #10 0x00007fdd9b83bc93 (/usr/local/bbbbbb/platform010/lib/libc.so.6+0x3bc93)
 #11 0x00007fdd8b7a189e clang::ASTNodeImporter::ImportDeclContext(clang::DeclContext*, bool) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:2154:9
 #12 0x00007fdd8b7f2e10 clang::ASTImporter::ImportDefinition(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:10189:19
 #13 0x00007fdd880a19ed lldb_private::ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo(clang::Decl*, clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:1171:19
 #14 0x00007fdd880a21e6 lldb_private::ClangASTImporter::CompleteTagDeclWithOrigin(clang::TagDecl*, clang::TagDecl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:828:57
 #15 0x00007fdd880c904c lldb_private::ClangASTSource::CompleteType(clang::TagDecl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:287:3
 #16 0x00007fdd8622a935 lldb_private::ClangASTSource::ClangASTSourceProxy::CompleteType(clang::TagDecl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h:230:7
 #17 0x00007fdd88126fbd lldb_private::ExternalASTSourceWrapper::CompleteType(clang::TagDecl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h:126:3
 #18 0x00007fdd88128166 lldb_private::SemaSourceWithPriorities::CompleteType(clang::TagDecl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h:428:11
 #19 0x00007fdd8b7a8b5c clang::ASTNodeImporter::VisitRecordDecl(clang::RecordDecl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:3113:5
 #20 0x00007fdd8b81f51a clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*>>::VisitCXXRecordDecl(clang::CXXRecordDecl*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/DeclNodes.inc:432:1
 #21 0x00007fdd8b7e46c3 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*>>::Visit(clang::Decl*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/DeclNodes.inc:432:1
 #22 0x00007fdd8b7e40a3 clang::ASTImporter::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9129:19
 #23 0x00007fdd880a3da9 lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:0:23
 #24 0x00007fdd8b7bd077 clang::ASTImporter::Import(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9497:8
 #25 0x00007fdd8b7a1acf clang::ASTImporter::ImportContext(clang::DeclContext*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9624:8
 #26 0x00007fdd8b79ecce clang::ASTNodeImporter::ImportDeclContext(clang::Decl*, clang::DeclContext*&, clang::DeclContext*&) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:2220:10
 #27 0x00007fdd8b79e942 clang::ASTNodeImporter::ImportDeclParts(clang::NamedDecl*, clang::DeclContext*&, clang::DeclContext*&, clang::DeclarationName&, clang::NamedDecl*&, clang::SourceLocation&) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:1952:19
 #28 0x00007fdd8b7a883a clang::ASTNodeImporter::VisitRecordDecl(clang::RecordDecl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:3082:13
 #29 0x00007fdd8b81f51a clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*>>::VisitCXXRecordDecl(clang::CXXRecordDecl*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/DeclNodes.inc:432:1
 #30 0x00007fdd8b7e46c3 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*>>::Visit(clang::Decl*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/DeclNodes.inc:432:1
 #31 0x00007fdd8b7e40a3 clang::ASTImporter::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9129:19
 #32 0x00007fdd880a3da9 lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:0:23
 #33 0x00007fdd8b7bd077 clang::ASTImporter::Import(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9497:8
 #34 0x00007fdd8b7a1acf clang::ASTImporter::ImportContext(clang::DeclContext*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9624:8
 #35 0x00007fdd8b79ecce clang::ASTNodeImporter::ImportDeclContext(clang::Decl*, clang::DeclContext*&, clang::DeclContext*&) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:2220:10
 #36 0x00007fdd8b79e942 clang::ASTNodeImporter::ImportDeclParts(clang::NamedDecl*, clang::DeclContext*&, clang::DeclContext*&, clang::DeclarationName&, clang::NamedDecl*&, clang::SourceLocation&) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:1952:19
 #37 0x00007fdd8b7b0f11 clang::ASTNodeImporter::VisitFieldDecl(clang::FieldDecl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:4163:13
 #38 0x00007fdd8b7e45d3 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*>>::Visit(clang::Decl*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/DeclNodes.inc:354:1
 #39 0x00007fdd8b7e40a3 clang::ASTImporter::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9129:19
 #40 0x00007fdd880a3da9 lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:0:23
 #41 0x00007fdd8b7bd077 clang::ASTImporter::Import(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9497:8
 #42 0x00007fdd8b7c6947 std::conditional<std::is_base_of_v<clang::Type, clang::FieldDecl>, llvm::Expected<clang::FieldDecl const*>, llvm::Expected<clang::FieldDecl*>>::type clang::ASTNodeImporter::import<clang::FieldDecl>(clang::FieldDecl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:204:12
 #43 0x00007fdd8b7e0b00 clang::ASTNodeImporter::VisitInitListExpr(clang::InitListExpr*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:8786:14
 #44 0x00007fdd8b7eb984 clang::StmtVisitorBase<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Stmt*>>::Visit(clang::Stmt*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/StmtNodes.inc:358:1
 #45 0x00007fdd8b7ea9f3 clang::ASTImporter::Import(clang::Stmt*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9704:36
 #46 0x00007fdd8b7e4b15 clang::ASTImporter::Import(clang::Expr*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9687:20
 #47 0x00007fdd8b78db27 std::conditional<std::is_base_of_v<clang::Type, clang::Expr>, llvm::Expected<clang::Expr const*>, llvm::Expected<clang::Expr*>>::type clang::ASTNodeImporter::import<clang::Expr>(clang::Expr*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:204:12
 #48 0x00007fdd8b817e3b llvm::Error clang::ASTNodeImporter::ImportArrayChecked<clang::Expr* const*, clang::Expr**>(clang::Expr* const*, clang::Expr* const*, clang::Expr**) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:705:14
 #49 0x00007fdd8b7d5191 llvm::Error clang::ASTNodeImporter::ImportContainerChecked<llvm::ArrayRef<clang::Expr*>, llvm::SmallVector<clang::Expr*, 4u>>(llvm::ArrayRef<clang::Expr*> const&, llvm::SmallVector<clang::Expr*, 4u>&) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:719:14
 #50 0x00007fdd8b7e08bb clang::ASTNodeImporter::VisitInitListExpr(clang::InitListExpr*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:8770:13
 #51 0x00007fdd8b7eb984 clang::StmtVisitorBase<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Stmt*>>::Visit(clang::Stmt*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/StmtNodes.inc:358:1
 #52 0x00007fdd8b7ea9f3 clang::ASTImporter::Import(clang::Stmt*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9704:36
 #53 0x00007fdd8b7e4b15 clang::ASTImporter::Import(clang::Expr*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9687:20
 #54 0x00007fdd8b78db27 std::conditional<std::is_base_of_v<clang::Type, clang::Expr>, llvm::Expected<clang::Expr const*>, llvm::Expected<clang::Expr*>>::type clang::ASTNodeImporter::import<clang::Expr>(clang::Expr*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:204:12
 #55 0x00007fdd8b817e3b llvm::Error clang::ASTNodeImporter::ImportArrayChecked<clang::Expr* const*, clang::Expr**>(clang::Expr* const*, clang::Expr* const*, clang::Expr**) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:705:14
 #56 0x00007fdd8b7d5191 llvm::Error clang::ASTNodeImporter::ImportContainerChecked<llvm::ArrayRef<clang::Expr*>, llvm::SmallVector<clang::Expr*, 4u>>(llvm::ArrayRef<clang::Expr*> const&, llvm::SmallVector<clang::Expr*, 4u>&) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:719:14
 #57 0x00007fdd8b7e08bb clang::ASTNodeImporter::VisitInitListExpr(clang::InitListExpr*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:8770:13
 #58 0x00007fdd8b7eb984 clang::StmtVisitorBase<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Stmt*>>::Visit(clang::Stmt*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/StmtNodes.inc:358:1
 #59 0x00007fdd8b7ea9f3 clang::ASTImporter::Import(clang::Stmt*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9704:36
 #60 0x00007fdd8b7e4b15 clang::ASTImporter::Import(clang::Expr*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9687:20
 #61 0x00007fdd8b78db27 std::conditional<std::is_base_of_v<clang::Type, clang::Expr>, llvm::Expected<clang::Expr const*>, llvm::Expected<clang::Expr*>>::type clang::ASTNodeImporter::import<clang::Expr>(clang::Expr*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:204:12
 #62 0x00007fdd8b798020 clang::Expr* clang::ASTNodeImporter::importChecked<clang::Expr*>(llvm::Error&, clang::Expr* const&) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:693:12
 #63 0x00007fdd8b7b1855 clang::ASTNodeImporter::VisitFieldDecl(clang::FieldDecl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:4240:8
 #64 0x00007fdd8b7e45d3 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*>>::Visit(clang::Decl*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/DeclNodes.inc:354:1
 #65 0x00007fdd8b7e40a3 clang::ASTImporter::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9129:19
 #66 0x00007fdd880a3da9 lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:0:23
 #67 0x00007fdd8b7bd077 clang::ASTImporter::Import(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9497:8
 #68 0x00007fdd8809c799 lldb_private::ClangASTImporter::CopyDecl(clang::ASTContext*, clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:82:8
 #69 0x00007fdd880cad95 lldb_private::ClangASTSource::CopyDecl(clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:1472:3
 #70 0x00007fdd880ca531 lldb_private::ClangASTSource::FindExternalLexicalDecls(clang::DeclContext const*, llvm::function_ref<bool (clang::Decl::Kind)>, llvm::SmallVectorImpl<clang::Decl*>&) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:465:13
 #71 0x00007fdd8622a905 lldb_private::ClangASTSource::ClangASTSourceProxy::FindExternalLexicalDecls(clang::DeclContext const*, llvm::function_ref<bool (clang::Decl::Kind)>, llvm::SmallVectorImpl<clang::Decl*>&) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h:226:7
 #72 0x00007fdd8b91cb5f clang::ExternalASTSource::FindExternalLexicalDecls(clang::DeclContext const*, llvm::SmallVectorImpl<clang::Decl*>&) kkkkkkkkk/llvm-project/clang/include/clang/AST/ExternalASTSource.h:215:3
 #73 0x00007fdd8b91c9e0 clang::DeclContext::LoadLexicalDeclsFromExternalStorage() const kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:1589:13
 #74 0x00007fdd8b91df3b clang::DeclContext::buildLookup() kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:1822:32
 #75 0x00007fdd8b91e856 clang::DeclContext::lookupImpl(clang::DeclarationName, clang::DeclContext const*) const kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:1931:9
 #76 0x00007fdd8b91e46f clang::DeclContext::lookup(clang::DeclarationName) const kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:1876:31
 #77 0x00007fdd8b926ec7 clang::CXXRecordDecl::getDestructor() const kkkkkkkkk/llvm-project/clang/lib/AST/DeclCXX.cpp:2130:34
 #78 0x00007fdd8b926cf8 clang::CXXRecordDecl::hasConstexprDestructor() const kkkkkkkkk/llvm-project/clang/lib/AST/DeclCXX.cpp:608:9
 #79 0x00007fdd8b926785 clang::CXXRecordDecl::addedClassSubobject(clang::CXXRecordDecl*) kkkkkkkkk/llvm-project/clang/lib/AST/DeclCXX.cpp:559:7
 #80 0x00007fdd8b929003 clang::CXXRecordDecl::addedMember(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/DeclCXX.cpp:1227:15
 #81 0x00007fdd8b91dac5 clang::DeclContext::addHiddenDecl(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:1779:8
 #82 0x00007fdd8b91ddcd clang::DeclContext::addDeclInternal(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:1796:38
 #83 0x00007fdd8b7b1823 clang::ASTNodeImporter::VisitFieldDecl(clang::FieldDecl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:4240:43
 #84 0x00007fdd8b7e45d3 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*>>::Visit(clang::Decl*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/DeclNodes.inc:354:1
 #85 0x00007fdd8b7e40a3 clang::ASTImporter::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9129:19
 #86 0x00007fdd880a3da9 lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:0:23
 #87 0x00007fdd8b7bd077 clang::ASTImporter::Import(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9497:8
 #88 0x00007fdd8809c799 lldb_private::ClangASTImporter::CopyDecl(clang::ASTContext*, clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:82:8
 #89 0x00007fdd880cad95 lldb_private::ClangASTSource::CopyDecl(clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:1472:3
 #90 0x00007fdd880ca531 lldb_private::ClangASTSource::FindExternalLexicalDecls(clang::DeclContext const*, llvm::function_ref<bool (clang::Decl::Kind)>, llvm::SmallVectorImpl<clang::Decl*>&) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:465:13
 #91 0x00007fdd8622a905 lldb_private::ClangASTSource::ClangASTSourceProxy::FindExternalLexicalDecls(clang::DeclContext const*, llvm::function_ref<bool (clang::Decl::Kind)>, llvm::SmallVectorImpl<clang::Decl*>&) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h:226:7
 #92 0x00007fdd8b91cb5f clang::ExternalASTSource::FindExternalLexicalDecls(clang::DeclContext const*, llvm::SmallVectorImpl<clang::Decl*>&) kkkkkkkkk/llvm-project/clang/include/clang/AST/ExternalASTSource.h:215:3
 #93 0x00007fdd8b91c9e0 clang::DeclContext::LoadLexicalDeclsFromExternalStorage() const kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:1589:13
 #94 0x00007fdd8b91df3b clang::DeclContext::buildLookup() kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:1822:32
 #95 0x00007fdd8b91dcce clang::DeclContext::makeDeclVisibleInContextWithFlags(clang::NamedDecl*, bool, bool) kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:2108:5
 #96 0x00007fdd8b91de06 clang::DeclContext::addDeclInternal(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/DeclBase.cpp:1799:1
 #97 0x00007fdd8b7b1823 clang::ASTNodeImporter::VisitFieldDecl(clang::FieldDecl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:4240:43
 #98 0x00007fdd8b7e45d3 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*>>::Visit(clang::Decl*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/clang/include/clang/AST/DeclNodes.inc:354:1
 #99 0x00007fdd8b7e40a3 clang::ASTImporter::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9129:19
#100 0x00007fdd880a3da9 lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:0:23
#101 0x00007fdd8b7bd077 clang::ASTImporter::Import(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:9497:8
#102 0x00007fdd8b78ffd7 std::conditional<std::is_base_of_v<clang::Type, clang::Decl>, llvm::Expected<clang::Decl const*>, llvm::Expected<clang::Decl*>>::type clang::ASTNodeImporter::import<clang::Decl>(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:204:12
#103 0x00007fdd8b7a14f6 clang::ASTNodeImporter::ImportDeclContext(clang::DeclContext*, bool) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:2097:10
#104 0x00007fdd8b7f2e10 clang::ASTImporter::ImportDefinition(clang::Decl*) kkkkkkkkk/llvm-project/clang/lib/AST/ASTImporter.cpp:10189:19
#105 0x00007fdd880a19ed lldb_private::ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo(clang::Decl*, clang::Decl*) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:1171:19
#106 0x00007fdd8809d79a (anonymous namespace)::CompleteTagDeclsScope::~CompleteTagDeclsScope() kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:268:13
#107 0x00007fdd8809d27c lldb_private::ClangASTImporter::DeportType(lldb_private::TypeSystemClang&, lldb_private::CompilerType const&) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:328:1
#108 0x00007fdd88104178 lldb_private::ClangExpressionDeclMap::DeportType(lldb_private::TypeSystemClang&, lldb_private::TypeSystemClang&, lldb_private::TaggedASTType<0u>) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:213:42
#109 0x00007fdd8810458c lldb_private::ClangExpressionDeclMap::AddPersistentVariable(clang::NamedDecl const*, lldb_private::ConstString, lldb_private::TaggedASTType<0u>, bool, bool) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:248:30
#110 0x00007fdd8816818a IRForTarget::CreateResultVariable(llvm::Function&) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp:392:7
#111 0x00007fdd8816f0d2 IRForTarget::runOnModule(llvm::Module&) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp:1655:9
#112 0x00007fdd880edf99 lldb_private::ClangExpressionParser::DoPrepareForExecution(unsigned long&, unsigned long&, std::shared_ptr<lldb_private::IRExecutionUnit>&, lldb_private::ExecutionContext&, bool&, lldb_private::ExecutionPolicy) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:1559:9
#113 0x00007fdd85d633a6 lldb_private::ExpressionParser::PrepareForExecution(unsigned long&, unsigned long&, std::shared_ptr<lldb_private::IRExecutionUnit>&, lldb_private::ExecutionContext&, bool&, lldb_private::ExecutionPolicy) kkkkkkkkk/llvm-project/lldb/source/Expression/ExpressionParser.cpp:24:7
#114 0x00007fdd881552cd lldb_private::ClangUserExpression::TryParse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp:610:20
#115 0x00007fdd88155a8c lldb_private::ClangUserExpression::Parse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool) kkkkkkkkk/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp:673:8
#116 0x00007fdd856dbec2 lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&, lldb_private::EvaluateExpressionOptions const&, llvm::StringRef, llvm::StringRef, std::shared_ptr<lldb_private::ValueObject>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, lldb_private::ValueObject*) kkkkkkkkk/llvm-project/lldb/source/Expression/UserExpression.cpp:279:8
#117 0x00007fdd859686b9 lldb_private::Target::EvaluateExpression(llvm::StringRef, lldb_private::ExecutionContextScope*, std::shared_ptr<lldb_private::ValueObject>&, lldb_private::EvaluateExpressionOptions const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, lldb_private::ValueObject*) kkkkkkkkk/llvm-project/lldb/source/Target/Target.cpp:2874:23
#118 0x00007fdd85336e11 lldb::SBFrame::EvaluateExpression(char const*, lldb::SBExpressionOptions const&) kkkkkkkkk/llvm-project/lldb/source/API/SBFrame.cpp:1121:42
#119 0x00007fdd85518c13 _wrap_SBFrame_EvaluateExpression__SWIG_3(_object*, long, _object**) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/lldb/bindings/python/LLDBWrapPython.cpp:36558:12
#120 0x00007fdd85470d4d _wrap_SBFrame_EvaluateExpression(_object*, _object*) xxxxx/build/Debug/bbbbbb-x86_64/toolchain/tools/lldb/bindings/python/LLDBWrapPython.cpp:36603:11
#121 0x00000000004fc6ee cfunction_call(_object*, _object*, _object*) (.__uniq.281047882695835599676768160755749362799.llvm.10898312759834640682) ./third-party/python/3.10/Objects/methodobject.c:0:0
#122 0x000000000036083c _PyObject_Call ./third-party/python/3.10/Objects/call.c:305:0
#123 0x000000000036083c PyObject_Call ./third-party/python/3.10/Objects/call.c:317:0
#124 0x000000000031a5f5 do_call_core(_ts*, PyTraceInfo*, _object*, _object*, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#125 0x000000000031a5f5 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4277:0
#126 0x00000000003a33a4 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#127 0x00000000003a33a4 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#128 0x00000000003a33a4 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#129 0x000000000051c9b3 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#130 0x000000000031a022 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4199:0
#131 0x00000000003a1e41 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#132 0x00000000003a1e41 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#133 0x00000000003a1e41 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#134 0x00000000003a1e41 _PyObject_VectorcallTstate(_ts*, _object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013) ./third-party/python/3.10/Include/cpython/abstract.h:114:0
#135 0x00000000003a1e41 method_vectorcall(_object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013.llvm.9049959812251520350) ./third-party/python/3.10/Objects/classobject.c:53:0
#136 0x000000000051c9b3 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#137 0x000000000031a193 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4231:0
#138 0x00000000003a33a4 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#139 0x00000000003a33a4 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#140 0x00000000003a33a4 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#141 0x000000000031a5f5 do_call_core(_ts*, PyTraceInfo*, _object*, _object*, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#142 0x000000000031a5f5 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4277:0
#143 0x00000000003a33a4 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#144 0x00000000003a33a4 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#145 0x00000000003a33a4 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#146 0x000000000051c9b3 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#147 0x000000000031a0f0 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4214:0
#148 0x00000000003a1e41 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#149 0x00000000003a1e41 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#150 0x00000000003a1e41 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#151 0x00000000003a1e41 _PyObject_VectorcallTstate(_ts*, _object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013) ./third-party/python/3.10/Include/cpython/abstract.h:114:0
#152 0x00000000003a1e41 method_vectorcall(_object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013.llvm.9049959812251520350) ./third-party/python/3.10/Objects/classobject.c:53:0
#153 0x000000000051c9b3 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#154 0x000000000031a0f0 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4214:0
#155 0x00000000003a33a4 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#156 0x00000000003a33a4 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#157 0x00000000003a33a4 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#158 0x000000000051c9b3 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#159 0x000000000031a022 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4199:0
#160 0x00000000003a1fa6 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#161 0x00000000003a1fa6 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#162 0x00000000003a1fa6 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#163 0x00000000003a1fa6 _PyObject_VectorcallTstate(_ts*, _object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013) ./third-party/python/3.10/Include/cpython/abstract.h:114:0
#164 0x00000000003a1fa6 method_vectorcall(_object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013.llvm.9049959812251520350) ./third-party/python/3.10/Objects/classobject.c:83:0
#165 0x000000000031a5f5 do_call_core(_ts*, PyTraceInfo*, _object*, _object*, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#166 0x000000000031a5f5 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4277:0
#167 0x000000000030f6ec _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#168 0x000000000030f6ec _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#169 0x000000000030f6ec _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#170 0x000000000030f6ec _PyObject_FastCallDictTstate ./third-party/python/3.10/Objects/call.c:142:0
#171 0x000000000030f6ec _PyObject_Call_Prepend ./third-party/python/3.10/Objects/call.c:431:0
#172 0x0000000000506b2a slot_tp_call(_object*, _object*, _object*) (.__uniq.235726554139783955843240177532338160225) ./third-party/python/3.10/Objects/typeobject.c:0:0
#173 0x000000000051cd44 _PyObject_MakeTpCall ./third-party/python/3.10/Objects/call.c:215:0
#174 0x000000000051cd44 _PyObject_VectorcallTstate(_ts*, _object*, _object* const*, unsigned long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/cpython/abstract.h:112:0
#175 0x000000000051cd44 PyObject_Vectorcall(_object*, _object* const*, unsigned long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/cpython/abstract.h:123:0
#176 0x000000000051cd44 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:5891:0
#177 0x000000000031a0f0 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4214:0
#178 0x00000000003a1fa6 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#179 0x00000000003a1fa6 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#180 0x00000000003a1fa6 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#181 0x00000000003a1fa6 _PyObject_VectorcallTstate(_ts*, _object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013) ./third-party/python/3.10/Include/cpython/abstract.h:114:0
#182 0x00000000003a1fa6 method_vectorcall(_object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013.llvm.9049959812251520350) ./third-party/python/3.10/Objects/classobject.c:83:0
#183 0x000000000031a5f5 do_call_core(_ts*, PyTraceInfo*, _object*, _object*, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#184 0x000000000031a5f5 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4277:0
#185 0x000000000030f6ec _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#186 0x000000000030f6ec _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#187 0x000000000030f6ec _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#188 0x000000000030f6ec _PyObject_FastCallDictTstate ./third-party/python/3.10/Objects/call.c:142:0
#189 0x000000000030f6ec _PyObject_Call_Prepend ./third-party/python/3.10/Objects/call.c:431:0
#190 0x0000000000506b2a slot_tp_call(_object*, _object*, _object*) (.__uniq.235726554139783955843240177532338160225) ./third-party/python/3.10/Objects/typeobject.c:0:0
#191 0x000000000051cd44 _PyObject_MakeTpCall ./third-party/python/3.10/Objects/call.c:215:0
#192 0x000000000051cd44 _PyObject_VectorcallTstate(_ts*, _object*, _object* const*, unsigned long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/cpython/abstract.h:112:0
#193 0x000000000051cd44 PyObject_Vectorcall(_object*, _object* const*, unsigned long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/cpython/abstract.h:123:0
#194 0x000000000051cd44 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:5891:0
#195 0x000000000031a0f0 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4214:0
#196 0x00000000003a1fa6 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#197 0x00000000003a1fa6 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#198 0x00000000003a1fa6 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#199 0x00000000003a1fa6 _PyObject_VectorcallTstate(_ts*, _object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013) ./third-party/python/3.10/Include/cpython/abstract.h:114:0
#200 0x00000000003a1fa6 method_vectorcall(_object*, _object* const*, unsigned long, _object*) (.__uniq.243338978568352371442406765225626566013.llvm.9049959812251520350) ./third-party/python/3.10/Objects/classobject.c:83:0
#201 0x000000000031a5f5 do_call_core(_ts*, PyTraceInfo*, _object*, _object*, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#202 0x000000000031a5f5 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4277:0
#203 0x000000000030f6ec _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#204 0x000000000030f6ec _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#205 0x000000000030f6ec _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#206 0x000000000030f6ec _PyObject_FastCallDictTstate ./third-party/python/3.10/Objects/call.c:142:0
#207 0x000000000030f6ec _PyObject_Call_Prepend ./third-party/python/3.10/Objects/call.c:431:0
#208 0x0000000000506b2a slot_tp_call(_object*, _object*, _object*) (.__uniq.235726554139783955843240177532338160225) ./third-party/python/3.10/Objects/typeobject.c:0:0
#209 0x000000000051cd44 _PyObject_MakeTpCall ./third-party/python/3.10/Objects/call.c:215:0
#210 0x000000000051cd44 _PyObject_VectorcallTstate(_ts*, _object*, _object* const*, unsigned long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/cpython/abstract.h:112:0
#211 0x000000000051cd44 PyObject_Vectorcall(_object*, _object* const*, unsigned long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/cpython/abstract.h:123:0
#212 0x000000000051cd44 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:5891:0
#213 0x000000000031a0f0 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4214:0
#214 0x00000000003a33a4 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#215 0x00000000003a33a4 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#216 0x00000000003a33a4 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#217 0x000000000051c9b3 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#218 0x000000000031a022 _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4199:0
#219 0x00000000003a33a4 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#220 0x00000000003a33a4 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#221 0x00000000003a33a4 _PyFunction_Vectorcall ./third-party/python/3.10/Objects/call.c:0:0
#222 0x000000000051c9b3 call_function(_ts*, PyTraceInfo*, _object***, long, _object*) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Python/ceval.c:0:0
#223 0x000000000031a04e _PyEval_EvalFrameDefault ./third-party/python/3.10/Python/ceval.c:4182:0
#224 0x0000000000310ad7 _PyEval_EvalFrame(_ts*, _frame*, int) (.__uniq.79849310599369217189729546442812793949) ./third-party/python/3.10/Include/internal/pycore_ceval.h:46:0
#225 0x0000000000310ad7 _PyEval_Vector ./third-party/python/3.10/Python/ceval.c:5065:0
#226 0x0000000000432074 PyEval_EvalCode ./third-party/python/3.10/Python/ceval.c:1134:0
#227 0x0000000000432074 run_eval_code_obj(_ts*, PyCodeObject*, _object*, _object*) (.__uniq.251861886623903963524397139660542440724) ./third-party/python/3.10/Python/pythonrun.c:1291:0
#228 0x0000000000432074 run_mod(_mod*, _object*, _object*, _object*, PyCompilerFlags*, _arena*) (.__uniq.251861886623903963524397139660542440724.llvm.1652559620328651533) ./third-party/python/3.10/Python/pythonrun.c:1312:0
#229 0x00000000004a9bb7 pyrun_file(_IO_FILE*, _object*, int, _object*, _object*, int, PyCompilerFlags*) (.__uniq.251861886623903963524397139660542440724) ./third-party/python/3.10/Python/pythonrun.c:1208:0
#230 0x00000000004a963f _PyRun_SimpleFileObject ./third-party/python/3.10/Python/pythonrun.c:456:0
#231 0x00000000004a8ea2 _PyRun_AnyFileObject ./third-party/python/3.10/Python/pythonrun.c:90:0
#232 0x00000000004a8cb7 pymain_run_file_obj(_object*, _object*, int) (.__uniq.297908980262787110426434251325078884054) ./third-party/python/3.10/Modules/main.c:354:0
#233 0x00000000004a8cb7 pymain_run_file(PyConfig const*) (.__uniq.297908980262787110426434251325078884054) ./third-party/python/3.10/Modules/main.c:372:0
#234 0x00000000004238c6 pymain_run_python(int*) (.__uniq.297908980262787110426434251325078884054) ./third-party/python/3.10/Modules/main.c:0:0
#235 0x00000000004238c6 Py_RunMain ./third-party/python/3.10/Modules/main.c:666:0
#236 0x000000000041dc31 pymain_main(_PyArgv*) (.__uniq.297908980262787110426434251325078884054.llvm.15781203083003229403) ./third-party/python/3.10/Modules/main.c:697:0
#237 0x000000000041da1b main ./third-party/python/3.10/Programs/python.c:15:0
#238 0x00007fdd9b82c657 __libc_start_call_main /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#239 0x00007fdd9b82c718 call_init /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../csu/libc-start.c:128:20
#240 0x00007fdd9b82c718 __libc_start_main@GLIBC_2.2.5 /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../csu/libc-start.c:379:5
#241 0x00000000005257b1 _start /home/engshare/third-party2/glibc/2.34/src/glibc-2.34/csu/../sysdeps/x86_64/start.S:118:0

--

********************
********************
Unresolved Tests (1):
  lldb-api :: commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py


Testing Time: 57.62s

Total Discovered Tests: 1
  Unresolved: 1 (100.00%)

@winner245
Copy link
Contributor Author

@shafik @zyn-li
Thank you for your feedback regarding the lldb failure. After discussions with @dmpots, we identified that the issue stems from an implicit dependency on <__ranges/movable_box.h> in lldb’s tests, likely due to clang’s AST processing. This patch itself does not introduce issues to libc++. I’ve submitted a temporary fix in #140960 by re-adding the header. However, a long-term solution may require deeper investigation by the lldb or clang teams, and I’d welcome their input on this.

@zyn-li
Copy link

zyn-li commented May 21, 2025

@winner245 Thank you for submitting this fix! I will follow up on my side with @dmpots. Will definitely share more if we have more findings regarding this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants