Skip to content

[libc++] Put _LIBCPP_NODEBUG on all internal aliases #118710

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 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libcxx/include/__algorithm/comp_ref_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ struct __debug_less {
// Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference.
#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
template <class _Comp>
using __comp_ref_type = __debug_less<_Comp>;
using __comp_ref_type _LIBCPP_NODEBUG = __debug_less<_Comp>;
#else
template <class _Comp>
using __comp_ref_type = _Comp&;
using __comp_ref_type _LIBCPP_NODEBUG = _Comp&;
#endif

_LIBCPP_END_NAMESPACE_STD
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct __copy_impl {

template <class _InIter, class _OutIter>
struct _CopySegment {
using _Traits = __segmented_iterator_traits<_InIter>;
using _Traits _LIBCPP_NODEBUG = __segmented_iterator_traits<_InIter>;

_OutIter& __result_;

Expand Down
18 changes: 9 additions & 9 deletions libcxx/include/__algorithm/iterator_operations.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ struct _RangeAlgPolicy {};
template <>
struct _IterOps<_RangeAlgPolicy> {
template <class _Iter>
using __value_type = iter_value_t<_Iter>;
using __value_type _LIBCPP_NODEBUG = iter_value_t<_Iter>;

template <class _Iter>
using __iterator_category = ranges::__iterator_concept<_Iter>;
using __iterator_category _LIBCPP_NODEBUG = ranges::__iterator_concept<_Iter>;

template <class _Iter>
using __difference_type = iter_difference_t<_Iter>;
using __difference_type _LIBCPP_NODEBUG = iter_difference_t<_Iter>;

static constexpr auto advance = ranges::advance;
static constexpr auto distance = ranges::distance;
Expand All @@ -72,13 +72,13 @@ struct _ClassicAlgPolicy {};
template <>
struct _IterOps<_ClassicAlgPolicy> {
template <class _Iter>
using __value_type = typename iterator_traits<_Iter>::value_type;
using __value_type _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::value_type;

template <class _Iter>
using __iterator_category = typename iterator_traits<_Iter>::iterator_category;
using __iterator_category _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::iterator_category;

template <class _Iter>
using __difference_type = typename iterator_traits<_Iter>::difference_type;
using __difference_type _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::difference_type;

// advance
template <class _Iter, class _Distance>
Expand All @@ -94,10 +94,10 @@ struct _IterOps<_ClassicAlgPolicy> {
}

template <class _Iter>
using __deref_t = decltype(*std::declval<_Iter&>());
using __deref_t _LIBCPP_NODEBUG = decltype(*std::declval<_Iter&>());

template <class _Iter>
using __move_t = decltype(std::move(*std::declval<_Iter&>()));
using __move_t _LIBCPP_NODEBUG = decltype(std::move(*std::declval<_Iter&>()));

template <class _Iter>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static void __validate_iter_reference() {
Expand Down Expand Up @@ -217,7 +217,7 @@ struct _IterOps<_ClassicAlgPolicy> {
};

template <class _AlgPolicy, class _Iter>
using __policy_iter_diff_t = typename _IterOps<_AlgPolicy>::template __difference_type<_Iter>;
using __policy_iter_diff_t _LIBCPP_NODEBUG = typename _IterOps<_AlgPolicy>::template __difference_type<_Iter>;

_LIBCPP_END_NAMESPACE_STD

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/move.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct __move_impl {

template <class _InIter, class _OutIter>
struct _MoveSegment {
using _Traits = __segmented_iterator_traits<_InIter>;
using _Traits _LIBCPP_NODEBUG = __segmented_iterator_traits<_InIter>;

_OutIter& __result_;

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/ranges_iterator_concept.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ consteval auto __get_iterator_concept() {
}

template <class _Iter>
using __iterator_concept = decltype(__get_iterator_concept<_Iter>());
using __iterator_concept _LIBCPP_NODEBUG = decltype(__get_iterator_concept<_Iter>());

} // namespace ranges
_LIBCPP_END_NAMESPACE_STD
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/ranges_unique_copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct __unique_copy {
}

template <class _InIter, class _OutIter>
using __algo_tag_t = decltype(__get_algo_tag<_InIter, _OutIter>());
using __algo_tag_t _LIBCPP_NODEBUG = decltype(__get_algo_tag<_InIter, _OutIter>());

template <input_iterator _InIter,
sentinel_for<_InIter> _Sent,
Expand Down
6 changes: 3 additions & 3 deletions libcxx/include/__algorithm/simd_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct __get_as_integer_type_impl<8> {
};

template <class _Tp>
using __get_as_integer_type_t = typename __get_as_integer_type_impl<sizeof(_Tp)>::type;
using __get_as_integer_type_t _LIBCPP_NODEBUG = typename __get_as_integer_type_impl<sizeof(_Tp)>::type;

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

template <class _ArithmeticT, size_t _Np>
using __simd_vector __attribute__((__ext_vector_type__(_Np))) = _ArithmeticT;
using __simd_vector __attribute__((__ext_vector_type__(_Np))) _LIBCPP_NODEBUG = _ArithmeticT;

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

template <class _VecT>
using __simd_vector_underlying_type_t = decltype(std::__simd_vector_underlying_type_impl(_VecT{}));
using __simd_vector_underlying_type_t _LIBCPP_NODEBUG = decltype(std::__simd_vector_underlying_type_impl(_VecT{}));

// This isn't inlined without always_inline when loading chars.
template <class _VecT, class _Iter>
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__algorithm/sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -890,10 +890,10 @@ __sort_dispatch(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
}

template <class _Type, class... _Options>
using __is_any_of = _Or<is_same<_Type, _Options>...>;
using __is_any_of _LIBCPP_NODEBUG = _Or<is_same<_Type, _Options>...>;

template <class _Type>
using __sort_is_specialized_in_library = __is_any_of<
using __sort_is_specialized_in_library _LIBCPP_NODEBUG = __is_any_of<
_Type,
char,
#if _LIBCPP_HAS_WIDE_CHARACTERS
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__algorithm/three_way_comp_ref_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ struct __debug_three_way_comp {
// Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference.
# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
template <class _Comp>
using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>;
using __three_way_comp_ref_type _LIBCPP_NODEBUG = __debug_three_way_comp<_Comp>;
# else
template <class _Comp>
using __three_way_comp_ref_type = _Comp&;
using __three_way_comp_ref_type _LIBCPP_NODEBUG = _Comp&;
# endif

#endif // _LIBCPP_STD_VER >= 20
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__algorithm/unwrap_iter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct __unwrap_iter_impl {
// It's a contiguous iterator, so we can use a raw pointer instead
template <class _Iter>
struct __unwrap_iter_impl<_Iter, true> {
using _ToAddressT = decltype(std::__to_address(std::declval<_Iter>()));
using _ToAddressT _LIBCPP_NODEBUG = decltype(std::__to_address(std::declval<_Iter>()));

static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __rewrap(_Iter __orig_iter, _ToAddressT __unwrapped_iter) {
return __orig_iter + (__unwrapped_iter - std::__to_address(__orig_iter));
Expand Down
10 changes: 5 additions & 5 deletions libcxx/include/__atomic/aliases.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,19 @@ using atomic_uintmax_t = atomic<uintmax_t>;
// C++20 atomic_{signed,unsigned}_lock_free: prefer the contention type most highly, then the largest lock-free type
#if _LIBCPP_STD_VER >= 20
# if ATOMIC_LLONG_LOCK_FREE == 2
using __largest_lock_free_type = long long;
using __largest_lock_free_type _LIBCPP_NODEBUG = long long;
# elif ATOMIC_INT_LOCK_FREE == 2
using __largest_lock_free_type = int;
using __largest_lock_free_type _LIBCPP_NODEBUG = int;
# elif ATOMIC_SHORT_LOCK_FREE == 2
using __largest_lock_free_type = short;
using __largest_lock_free_type _LIBCPP_NODEBUG = short;
# elif ATOMIC_CHAR_LOCK_FREE == 2
using __largest_lock_free_type = char;
using __largest_lock_free_type _LIBCPP_NODEBUG = char;
# else
# define _LIBCPP_NO_LOCK_FREE_TYPES // There are no lockfree types (this can happen on unusual platforms)
# endif

# ifndef _LIBCPP_NO_LOCK_FREE_TYPES
using __contention_t_or_largest =
using __contention_t_or_largest _LIBCPP_NODEBUG =
__conditional_t<__libcpp_is_always_lock_free<__cxx_contention_t>::__value,
__cxx_contention_t,
__largest_lock_free_type>;
Expand Down
20 changes: 10 additions & 10 deletions libcxx/include/__atomic/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct __atomic_base // false

template <class _Tp>
struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> {
using __base = __atomic_base<_Tp, false>;
using __base _LIBCPP_NODEBUG = __atomic_base<_Tp, false>;

_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __atomic_base() _NOEXCEPT = default;

Expand Down Expand Up @@ -228,9 +228,9 @@ struct __atomic_waitable_traits<__atomic_base<_Tp, _IsIntegral> > {

template <class _Tp>
struct atomic : public __atomic_base<_Tp> {
using __base = __atomic_base<_Tp>;
using value_type = _Tp;
using difference_type = value_type;
using __base _LIBCPP_NODEBUG = __atomic_base<_Tp>;
using value_type = _Tp;
using difference_type = value_type;

#if _LIBCPP_STD_VER >= 20
_LIBCPP_HIDE_FROM_ABI atomic() = default;
Expand All @@ -257,9 +257,9 @@ struct atomic : public __atomic_base<_Tp> {

template <class _Tp>
struct atomic<_Tp*> : public __atomic_base<_Tp*> {
using __base = __atomic_base<_Tp*>;
using value_type = _Tp*;
using difference_type = ptrdiff_t;
using __base _LIBCPP_NODEBUG = __atomic_base<_Tp*>;
using value_type = _Tp*;
using difference_type = ptrdiff_t;

_LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default;

Expand Down Expand Up @@ -389,9 +389,9 @@ struct atomic<_Tp> : __atomic_base<_Tp> {
}

public:
using __base = __atomic_base<_Tp>;
using value_type = _Tp;
using difference_type = value_type;
using __base _LIBCPP_NODEBUG = __atomic_base<_Tp>;
using value_type = _Tp;
using difference_type = value_type;

_LIBCPP_HIDE_FROM_ABI constexpr atomic() noexcept = default;
_LIBCPP_HIDE_FROM_ABI constexpr atomic(_Tp __d) noexcept : __base(__d) {}
Expand Down
10 changes: 5 additions & 5 deletions libcxx/include/__atomic/atomic_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ struct __atomic_ref_base {
_LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); }

protected:
using _Aligned_Tp [[__gnu__::__aligned__(required_alignment)]] = _Tp;
using _Aligned_Tp [[__gnu__::__aligned__(required_alignment), __gnu__::__nodebug__]] = _Tp;
_Aligned_Tp* __ptr_;

_LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __ptr_(std::addressof(__obj)) {}
Expand All @@ -241,7 +241,7 @@ template <class _Tp>
struct atomic_ref : public __atomic_ref_base<_Tp> {
static_assert(is_trivially_copyable_v<_Tp>, "std::atomic_ref<T> requires that 'T' be a trivially copyable type");

using __base = __atomic_ref_base<_Tp>;
using __base _LIBCPP_NODEBUG = __atomic_ref_base<_Tp>;

_LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) {
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
Expand All @@ -259,7 +259,7 @@ struct atomic_ref : public __atomic_ref_base<_Tp> {
template <class _Tp>
requires(std::integral<_Tp> && !std::same_as<bool, _Tp>)
struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
using __base = __atomic_ref_base<_Tp>;
using __base _LIBCPP_NODEBUG = __atomic_ref_base<_Tp>;

using difference_type = __base::value_type;

Expand Down Expand Up @@ -305,7 +305,7 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
template <class _Tp>
requires std::floating_point<_Tp>
struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
using __base = __atomic_ref_base<_Tp>;
using __base _LIBCPP_NODEBUG = __atomic_ref_base<_Tp>;

using difference_type = __base::value_type;

Expand Down Expand Up @@ -344,7 +344,7 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {

template <class _Tp>
struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> {
using __base = __atomic_ref_base<_Tp*>;
using __base _LIBCPP_NODEBUG = __atomic_ref_base<_Tp*>;

using difference_type = ptrdiff_t;

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__atomic/atomic_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct __atomic_wait_backoff_impl {
_Poll __poll_;
memory_order __order_;

using __waitable_traits = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >;
using __waitable_traits _LIBCPP_NODEBUG = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >;

_LIBCPP_AVAILABILITY_SYNC
_LIBCPP_HIDE_FROM_ABI bool
Expand Down
6 changes: 3 additions & 3 deletions libcxx/include/__atomic/contention_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD

#if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
using __cxx_contention_t = int32_t;
using __cxx_contention_t _LIBCPP_NODEBUG = int32_t;
#else
using __cxx_contention_t = int64_t;
using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
#endif // __linux__ || (_AIX && !__64BIT__)

using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>;
using __cxx_atomic_contention_t _LIBCPP_NODEBUG = __cxx_atomic_impl<__cxx_contention_t>;

_LIBCPP_END_NAMESPACE_STD

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__atomic/memory_order.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// to pin the underlying type in C++20.
enum __legacy_memory_order { __mo_relaxed, __mo_consume, __mo_acquire, __mo_release, __mo_acq_rel, __mo_seq_cst };

using __memory_order_underlying_t = underlying_type<__legacy_memory_order>::type;
using __memory_order_underlying_t _LIBCPP_NODEBUG = underlying_type<__legacy_memory_order>::type;

#if _LIBCPP_STD_VER >= 20

Expand Down
24 changes: 12 additions & 12 deletions libcxx/include/__bit_reference
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ struct __has_storage_type {

template <class _Cp, bool = __has_storage_type<_Cp>::value>
class __bit_reference {
using __storage_type = typename _Cp::__storage_type;
using __storage_pointer = typename _Cp::__storage_pointer;
using __storage_type _LIBCPP_NODEBUG = typename _Cp::__storage_type;
using __storage_pointer _LIBCPP_NODEBUG = typename _Cp::__storage_pointer;

__storage_pointer __seg_;
__storage_type __mask_;
Expand All @@ -55,7 +55,7 @@ class __bit_reference {
friend class __bit_iterator<_Cp, false>;

public:
using __container = typename _Cp::__self;
using __container _LIBCPP_NODEBUG = typename _Cp::__self;

_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_reference(const __bit_reference&) = default;

Expand Down Expand Up @@ -135,8 +135,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(bool& __x,

template <class _Cp>
class __bit_const_reference {
using __storage_type = typename _Cp::__storage_type;
using __storage_pointer = typename _Cp::__const_storage_pointer;
using __storage_type _LIBCPP_NODEBUG = typename _Cp::__storage_type;
using __storage_pointer _LIBCPP_NODEBUG = typename _Cp::__const_storage_pointer;

__storage_pointer __seg_;
__storage_type __mask_;
Expand All @@ -145,7 +145,7 @@ class __bit_const_reference {
friend class __bit_iterator<_Cp, true>;

public:
using __container = typename _Cp::__self;
using __container _LIBCPP_NODEBUG = typename _Cp::__self;

_LIBCPP_HIDE_FROM_ABI __bit_const_reference(const __bit_const_reference&) = default;
__bit_const_reference& operator=(const __bit_const_reference&) = delete;
Expand Down Expand Up @@ -587,10 +587,10 @@ inline _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cr, false> swap_ranges(

template <class _Cp>
struct __bit_array {
using difference_type = typename _Cp::difference_type;
using __storage_type = typename _Cp::__storage_type;
using __storage_pointer = typename _Cp::__storage_pointer;
using iterator = typename _Cp::iterator;
using difference_type _LIBCPP_NODEBUG = typename _Cp::difference_type;
using __storage_type _LIBCPP_NODEBUG = typename _Cp::__storage_type;
using __storage_pointer _LIBCPP_NODEBUG = typename _Cp::__storage_pointer;
using iterator _LIBCPP_NODEBUG = typename _Cp::iterator;

static const unsigned __bits_per_word = _Cp::__bits_per_word;
static const unsigned _Np = 4;
Expand Down Expand Up @@ -790,8 +790,8 @@ public:
using iterator_category = random_access_iterator_tag;

private:
using __storage_type = typename _Cp::__storage_type;
using __storage_pointer =
using __storage_type _LIBCPP_NODEBUG = typename _Cp::__storage_type;
using __storage_pointer _LIBCPP_NODEBUG =
__conditional_t<_IsConst, typename _Cp::__const_storage_pointer, typename _Cp::__storage_pointer>;

static const unsigned __bits_per_word = _Cp::__bits_per_word;
Expand Down
Loading
Loading