Skip to content

Commit f695852

Browse files
authored
[libc++] Put _LIBCPP_NODEBUG on all internal aliases (#118710)
This significantly reduces the amount of debug information generated for codebases using libc++, without hurting the debugging experience.
1 parent 4751f47 commit f695852

File tree

156 files changed

+599
-504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+599
-504
lines changed

libcxx/include/__algorithm/comp_ref_type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ struct __debug_less {
5656
// Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference.
5757
#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
5858
template <class _Comp>
59-
using __comp_ref_type = __debug_less<_Comp>;
59+
using __comp_ref_type _LIBCPP_NODEBUG = __debug_less<_Comp>;
6060
#else
6161
template <class _Comp>
62-
using __comp_ref_type = _Comp&;
62+
using __comp_ref_type _LIBCPP_NODEBUG = _Comp&;
6363
#endif
6464

6565
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/copy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct __copy_impl {
4747

4848
template <class _InIter, class _OutIter>
4949
struct _CopySegment {
50-
using _Traits = __segmented_iterator_traits<_InIter>;
50+
using _Traits _LIBCPP_NODEBUG = __segmented_iterator_traits<_InIter>;
5151

5252
_OutIter& __result_;
5353

libcxx/include/__algorithm/iterator_operations.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ struct _RangeAlgPolicy {};
4848
template <>
4949
struct _IterOps<_RangeAlgPolicy> {
5050
template <class _Iter>
51-
using __value_type = iter_value_t<_Iter>;
51+
using __value_type _LIBCPP_NODEBUG = iter_value_t<_Iter>;
5252

5353
template <class _Iter>
54-
using __iterator_category = ranges::__iterator_concept<_Iter>;
54+
using __iterator_category _LIBCPP_NODEBUG = ranges::__iterator_concept<_Iter>;
5555

5656
template <class _Iter>
57-
using __difference_type = iter_difference_t<_Iter>;
57+
using __difference_type _LIBCPP_NODEBUG = iter_difference_t<_Iter>;
5858

5959
static constexpr auto advance = ranges::advance;
6060
static constexpr auto distance = ranges::distance;
@@ -72,13 +72,13 @@ struct _ClassicAlgPolicy {};
7272
template <>
7373
struct _IterOps<_ClassicAlgPolicy> {
7474
template <class _Iter>
75-
using __value_type = typename iterator_traits<_Iter>::value_type;
75+
using __value_type _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::value_type;
7676

7777
template <class _Iter>
78-
using __iterator_category = typename iterator_traits<_Iter>::iterator_category;
78+
using __iterator_category _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::iterator_category;
7979

8080
template <class _Iter>
81-
using __difference_type = typename iterator_traits<_Iter>::difference_type;
81+
using __difference_type _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::difference_type;
8282

8383
// advance
8484
template <class _Iter, class _Distance>
@@ -94,10 +94,10 @@ struct _IterOps<_ClassicAlgPolicy> {
9494
}
9595

9696
template <class _Iter>
97-
using __deref_t = decltype(*std::declval<_Iter&>());
97+
using __deref_t _LIBCPP_NODEBUG = decltype(*std::declval<_Iter&>());
9898

9999
template <class _Iter>
100-
using __move_t = decltype(std::move(*std::declval<_Iter&>()));
100+
using __move_t _LIBCPP_NODEBUG = decltype(std::move(*std::declval<_Iter&>()));
101101

102102
template <class _Iter>
103103
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static void __validate_iter_reference() {
@@ -217,7 +217,7 @@ struct _IterOps<_ClassicAlgPolicy> {
217217
};
218218

219219
template <class _AlgPolicy, class _Iter>
220-
using __policy_iter_diff_t = typename _IterOps<_AlgPolicy>::template __difference_type<_Iter>;
220+
using __policy_iter_diff_t _LIBCPP_NODEBUG = typename _IterOps<_AlgPolicy>::template __difference_type<_Iter>;
221221

222222
_LIBCPP_END_NAMESPACE_STD
223223

libcxx/include/__algorithm/move.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct __move_impl {
5050

5151
template <class _InIter, class _OutIter>
5252
struct _MoveSegment {
53-
using _Traits = __segmented_iterator_traits<_InIter>;
53+
using _Traits _LIBCPP_NODEBUG = __segmented_iterator_traits<_InIter>;
5454

5555
_OutIter& __result_;
5656

libcxx/include/__algorithm/ranges_iterator_concept.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ consteval auto __get_iterator_concept() {
4444
}
4545

4646
template <class _Iter>
47-
using __iterator_concept = decltype(__get_iterator_concept<_Iter>());
47+
using __iterator_concept _LIBCPP_NODEBUG = decltype(__get_iterator_concept<_Iter>());
4848

4949
} // namespace ranges
5050
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__algorithm/ranges_unique_copy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct __unique_copy {
6060
}
6161

6262
template <class _InIter, class _OutIter>
63-
using __algo_tag_t = decltype(__get_algo_tag<_InIter, _OutIter>());
63+
using __algo_tag_t _LIBCPP_NODEBUG = decltype(__get_algo_tag<_InIter, _OutIter>());
6464

6565
template <input_iterator _InIter,
6666
sentinel_for<_InIter> _Sent,

libcxx/include/__algorithm/simd_utils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct __get_as_integer_type_impl<8> {
7070
};
7171

7272
template <class _Tp>
73-
using __get_as_integer_type_t = typename __get_as_integer_type_impl<sizeof(_Tp)>::type;
73+
using __get_as_integer_type_t _LIBCPP_NODEBUG = typename __get_as_integer_type_impl<sizeof(_Tp)>::type;
7474

7575
// This isn't specialized for 64 byte vectors on purpose. They have the potential to significantly reduce performance
7676
// in mixed simd/non-simd workloads and don't provide any performance improvement for currently vectorized algorithms
@@ -90,7 +90,7 @@ inline constexpr size_t __native_vector_size = 1;
9090
# endif
9191

9292
template <class _ArithmeticT, size_t _Np>
93-
using __simd_vector __attribute__((__ext_vector_type__(_Np))) = _ArithmeticT;
93+
using __simd_vector __attribute__((__ext_vector_type__(_Np))) _LIBCPP_NODEBUG = _ArithmeticT;
9494

9595
template <class _VecT>
9696
inline constexpr size_t __simd_vector_size_v = []<bool _False = false>() -> size_t {
@@ -106,7 +106,7 @@ _LIBCPP_HIDE_FROM_ABI _Tp __simd_vector_underlying_type_impl(__simd_vector<_Tp,
106106
}
107107

108108
template <class _VecT>
109-
using __simd_vector_underlying_type_t = decltype(std::__simd_vector_underlying_type_impl(_VecT{}));
109+
using __simd_vector_underlying_type_t _LIBCPP_NODEBUG = decltype(std::__simd_vector_underlying_type_impl(_VecT{}));
110110

111111
// This isn't inlined without always_inline when loading chars.
112112
template <class _VecT, class _Iter>

libcxx/include/__algorithm/sort.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,10 +890,10 @@ __sort_dispatch(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
890890
}
891891

892892
template <class _Type, class... _Options>
893-
using __is_any_of = _Or<is_same<_Type, _Options>...>;
893+
using __is_any_of _LIBCPP_NODEBUG = _Or<is_same<_Type, _Options>...>;
894894

895895
template <class _Type>
896-
using __sort_is_specialized_in_library = __is_any_of<
896+
using __sort_is_specialized_in_library _LIBCPP_NODEBUG = __is_any_of<
897897
_Type,
898898
char,
899899
#if _LIBCPP_HAS_WIDE_CHARACTERS

libcxx/include/__algorithm/three_way_comp_ref_type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ struct __debug_three_way_comp {
6161
// Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference.
6262
# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
6363
template <class _Comp>
64-
using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>;
64+
using __three_way_comp_ref_type _LIBCPP_NODEBUG = __debug_three_way_comp<_Comp>;
6565
# else
6666
template <class _Comp>
67-
using __three_way_comp_ref_type = _Comp&;
67+
using __three_way_comp_ref_type _LIBCPP_NODEBUG = _Comp&;
6868
# endif
6969

7070
#endif // _LIBCPP_STD_VER >= 20

libcxx/include/__algorithm/unwrap_iter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct __unwrap_iter_impl {
4646
// It's a contiguous iterator, so we can use a raw pointer instead
4747
template <class _Iter>
4848
struct __unwrap_iter_impl<_Iter, true> {
49-
using _ToAddressT = decltype(std::__to_address(std::declval<_Iter>()));
49+
using _ToAddressT _LIBCPP_NODEBUG = decltype(std::__to_address(std::declval<_Iter>()));
5050

5151
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __rewrap(_Iter __orig_iter, _ToAddressT __unwrapped_iter) {
5252
return __orig_iter + (__unwrapped_iter - std::__to_address(__orig_iter));

0 commit comments

Comments
 (0)