Skip to content

[libc++] __uglify non-conforming member typedef base #112843

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
Oct 18, 2024
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
6 changes: 3 additions & 3 deletions libcxx/docs/ReleaseNotes/20.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ Deprecations and Removals
supported as an extension anymore, please migrate any code that uses e.g. ``std::vector<const T>`` to be
standards conforming.

- Non-conforming member typedefs ``iterator`` and ``const_iterator`` of ``std::bitset`` are removed. Previously, they
were private but could cause ambiguity in name lookup. Code that expects such ambiguity will possibly not compile in
LLVM 20.
- Non-conforming member typedefs ``base``, ``iterator`` and ``const_iterator`` of ``std::bitset``, and member typedef
``base`` of ``std::forward_list`` and ``std::list`` are removed. Previously, they were private but could cause
ambiguity in name lookup. Code that expects such ambiguity will possibly not compile in LLVM 20.

- The function ``__libcpp_verbose_abort()`` is now ``noexcept``, to match ``std::terminate()``. (The combination of
``noexcept`` and ``[[noreturn]]`` has special significance for function effects analysis.)
Expand Down
56 changes: 30 additions & 26 deletions libcxx/include/bitset
Original file line number Diff line number Diff line change
Expand Up @@ -612,15 +612,15 @@ class _LIBCPP_TEMPLATE_VIS bitset
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size> {
public:
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
typedef __bitset<__n_words, _Size> base;
typedef __bitset<__n_words, _Size> __base;

public:
typedef typename base::reference reference;
typedef typename base::const_reference const_reference;
typedef typename __base::reference reference;
typedef typename __base::const_reference const_reference;

// 23.3.5.1 constructors:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset(unsigned long long __v) _NOEXCEPT : __base(__v) {}
template <class _CharT, __enable_if_t<_IsCharLikeType<_CharT>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
const _CharT* __str,
Expand Down Expand Up @@ -681,11 +681,15 @@ public:

// element access:
#ifdef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const { return base::__make_ref(__p); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const { return __base::__make_ref(__p); }
#else
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const { return base::__make_ref(__p); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const {
return __base::__make_ref(__p);
}
#endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) { return base::__make_ref(__p); }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) {
return __base::__make_ref(__p);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const;
template <class _CharT, class _Traits, class _Allocator>
Expand Down Expand Up @@ -726,54 +730,54 @@ private:
_CharT __c = __str[__mp - 1 - __i];
(*this)[__i] = _Traits::eq(__c, __one);
}
std::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
std::fill(__base::__make_iter(__i), __base::__make_iter(_Size), false);
}

_LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return base::__hash_code(); }
_LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return __base::__hash_code(); }

friend struct hash<bitset>;
};

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>&
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT {
base::operator&=(__rhs);
__base::operator&=(__rhs);
return *this;
}

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>&
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT {
base::operator|=(__rhs);
__base::operator|=(__rhs);
return *this;
}

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>&
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT {
base::operator^=(__rhs);
__base::operator^=(__rhs);
return *this;
}

template <size_t _Size>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT {
__pos = std::min(__pos, _Size);
std::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
std::fill_n(base::__make_iter(0), __pos, false);
std::copy_backward(__base::__make_iter(0), __base::__make_iter(_Size - __pos), __base::__make_iter(_Size));
std::fill_n(__base::__make_iter(0), __pos, false);
return *this;
}

template <size_t _Size>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT {
__pos = std::min(__pos, _Size);
std::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
std::fill_n(base::__make_iter(_Size - __pos), __pos, false);
std::copy(__base::__make_iter(__pos), __base::__make_iter(_Size), __base::__make_iter(0));
std::fill_n(__base::__make_iter(_Size - __pos), __pos, false);
return *this;
}

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set() _NOEXCEPT {
std::fill_n(base::__make_iter(0), _Size, true);
std::fill_n(__base::__make_iter(0), _Size, true);
return *this;
}

Expand All @@ -788,7 +792,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset() _NOEXCEPT {
std::fill_n(base::__make_iter(0), _Size, false);
std::fill_n(__base::__make_iter(0), _Size, false);
return *this;
}

Expand All @@ -810,7 +814,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size> bitset<

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip() _NOEXCEPT {
base::flip();
__base::flip();
return *this;
}

Expand All @@ -819,19 +823,19 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>
if (__pos >= _Size)
__throw_out_of_range("bitset flip argument out of range");

reference __r = base::__make_ref(__pos);
reference __r = __base::__make_ref(__pos);
__r = ~__r;
return *this;
}

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long bitset<_Size>::to_ulong() const {
return base::to_ulong();
return __base::to_ulong();
}

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long bitset<_Size>::to_ullong() const {
return base::to_ullong();
return __base::to_ullong();
}

template <size_t _Size>
Expand Down Expand Up @@ -868,13 +872,13 @@ bitset<_Size>::to_string(char __zero, char __one) const {

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t bitset<_Size>::count() const _NOEXCEPT {
return static_cast<size_t>(std::count(base::__make_iter(0), base::__make_iter(_Size), true));
return static_cast<size_t>(std::count(__base::__make_iter(0), __base::__make_iter(_Size), true));
}

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT {
return std::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
return std::equal(__base::__make_iter(0), __base::__make_iter(_Size), __rhs.__make_iter(0));
}

#if _LIBCPP_STD_VER <= 17
Expand All @@ -896,12 +900,12 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::test(siz

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::all() const _NOEXCEPT {
return base::all();
return __base::all();
}

template <size_t _Size>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::any() const _NOEXCEPT {
return base::any();
return __base::any();
}

template <size_t _Size>
Expand Down
Loading
Loading