Skip to content
Draft
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
2 changes: 1 addition & 1 deletion libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ set(files
__concepts/invocable.h
__concepts/movable.h
__concepts/predicate.h
__concepts/referenceable.h
__concepts/regular.h
__concepts/relation.h
__concepts/same_as.h
Expand Down Expand Up @@ -856,7 +857,6 @@ set(files
__type_traits/is_primary_template.h
__type_traits/is_reference.h
__type_traits/is_reference_wrapper.h
__type_traits/is_referenceable.h
__type_traits/is_replaceable.h
__type_traits/is_same.h
__type_traits/is_scalar.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,27 @@
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
#define _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
#ifndef _LIBCPP___CONCEPTS_REFERENCEABLE_H
#define _LIBCPP___CONCEPTS_REFERENCEABLE_H

#include <__config>
#include <__type_traits/void_t.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20

template <class _Tp, class = void>
inline const bool __is_referenceable_v = false;
_LIBCPP_BEGIN_NAMESPACE_STD

template <class _Tp>
inline const bool __is_referenceable_v<_Tp, __void_t<_Tp&> > = true;
using __referenceable_impl _LIBCPP_NODEBUG = _Tp&;

#if _LIBCPP_STD_VER >= 20
template <class _Tp>
concept __referenceable = __is_referenceable_v<_Tp>;
#endif
concept __referenceable = requires { typename __referenceable_impl<_Tp>; };

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
#endif

#endif // _LIBCPP___CONCEPTS_REFERENCEABLE_H
13 changes: 0 additions & 13 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -1050,11 +1050,6 @@ typedef __char32_t char32_t;
# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "")
# endif

// TODO(LLVM 22): Remove the workaround
# if defined(__OBJC__) && (!defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER < 2001)
# define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS
# endif

# define _PSTL_PRAGMA(x) _Pragma(#x)

// Enable SIMD for compilers that support OpenMP 4.0
Expand Down Expand Up @@ -1255,14 +1250,6 @@ typedef __char32_t char32_t;
# define _LIBCPP_DIAGNOSE_NULLPTR
# endif

// TODO(LLVM 22): Remove this macro once LLVM19 support ends. __cpp_explicit_this_parameter has been set in LLVM20.
// Clang-18 has support for deducing this, but it does not set the FTM.
# if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1800)
# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER 1
# else
# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER 0
# endif

#endif // __cplusplus

#endif // _LIBCPP___CONFIG
8 changes: 0 additions & 8 deletions libcxx/include/__configuration/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@
// According to the Standard, `bitset::operator[] const` returns bool
# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL

// In LLVM 20, we've changed to take these ABI breaks unconditionally. These flags only exist in case someone is running
// into the static_asserts we added to catch the ABI break and don't care that it is one.
// TODO(LLVM 22): Remove these flags
# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB

// These flags are documented in ABIGuarantees.rst
# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
# define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
Expand Down
17 changes: 7 additions & 10 deletions libcxx/include/__format/format_arg.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_
__libcpp_unreachable();
}

# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
# if _LIBCPP_STD_VER >= 26

template <class _Rp, class _Visitor, class _Context>
_LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
Expand Down Expand Up @@ -200,7 +200,7 @@ _LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<
__libcpp_unreachable();
}

# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
# endif // _LIBCPP_STD_VER >= 26

/// Contains the values used in basic_format_arg.
///
Expand Down Expand Up @@ -285,7 +285,7 @@ class _LIBCPP_NO_SPECIALIZATIONS basic_format_arg {

_LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __type_ != __format::__arg_t::__none; }

# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
# if _LIBCPP_STD_VER >= 26

// This function is user facing, so it must wrap the non-standard types of
// the "variant" in a handle to stay conforming. See __arg_t for more details.
Expand Down Expand Up @@ -329,7 +329,7 @@ class _LIBCPP_NO_SPECIALIZATIONS basic_format_arg {
}
}

# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
# endif // _LIBCPP_STD_VER >= 26

private:
using char_type = typename _Context::char_type;
Expand Down Expand Up @@ -371,11 +371,8 @@ class basic_format_arg<_Context>::handle {
// This function is user facing, so it must wrap the non-standard types of
// the "variant" in a handle to stay conforming. See __arg_t for more details.
template <class _Visitor, class _Context>
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
_LIBCPP_DEPRECATED_IN_CXX26
# endif
_LIBCPP_HIDE_FROM_ABI decltype(auto)
visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
_LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_HIDE_FROM_ABI decltype(auto)
visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
switch (__arg.__type_) {
# if _LIBCPP_HAS_INT128
case __format::__arg_t::__i128: {
Expand All @@ -387,7 +384,7 @@ _LIBCPP_DEPRECATED_IN_CXX26
typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_};
return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
}
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
# endif // _LIBCPP_HAS_INT128
default:
return std::__visit_format_arg(std::forward<_Visitor>(__vis), __arg);
}
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__format/format_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ class basic_format_context<typename __format::__retarget_buffer<_CharT>::__itera
__format::__determine_arg_t<basic_format_context, decltype(__arg)>(),
__basic_format_arg_value<basic_format_context>(__arg)};
};
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
# if _LIBCPP_STD_VER >= 26
return static_cast<_Context*>(__c)->arg(__id).visit(std::move(__visitor));
# else
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
return std::visit_format_arg(std::move(__visitor), static_cast<_Context*>(__c)->arg(__id));
_LIBCPP_SUPPRESS_DEPRECATED_POP
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
# endif // _LIBCPP_STD_VER >= 26
}) {
}

Expand Down
12 changes: 0 additions & 12 deletions libcxx/include/__hash_table
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,6 @@ struct __hash_node_base {
typedef _NodePtr __node_pointer;
typedef __node_base_pointer __next_pointer;

// TODO(LLVM 22): Remove this check
#ifndef _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
static_assert(sizeof(__node_base_pointer) == sizeof(__node_pointer) && _LIBCPP_ALIGNOF(__node_base_pointer) ==
_LIBCPP_ALIGNOF(__node_pointer),
"It looks like you are using std::__hash_table (an implementation detail for the unordered containers) "
"with a fancy pointer type that thas a different representation depending on whether it points to a "
"__hash_table base pointer or a __hash_table node pointer (both of which are implementation details of "
"the standard library). This means that your ABI is being broken between LLVM 19 and LLVM 20. If you "
"don't care about your ABI being broken, define the _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB macro to "
"silence this diagnostic.");
#endif

__next_pointer __next_;

_LIBCPP_HIDE_FROM_ABI __next_pointer __ptr() _NOEXCEPT {
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__iterator/common_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <__concepts/copyable.h>
#include <__concepts/derived_from.h>
#include <__concepts/equality_comparable.h>
#include <__concepts/referenceable.h>
#include <__concepts/same_as.h>
#include <__config>
#include <__iterator/concepts.h>
Expand All @@ -28,7 +29,6 @@
#include <__memory/addressof.h>
#include <__type_traits/conditional.h>
#include <__type_traits/is_pointer.h>
#include <__type_traits/is_referenceable.h>
#include <__utility/declval.h>
#include <variant>

Expand Down
17 changes: 7 additions & 10 deletions libcxx/include/__iterator/concepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <__concepts/invocable.h>
#include <__concepts/movable.h>
#include <__concepts/predicate.h>
#include <__concepts/referenceable.h>
#include <__concepts/regular.h>
#include <__concepts/relation.h>
#include <__concepts/same_as.h>
Expand All @@ -40,7 +41,6 @@
#include <__type_traits/is_pointer.h>
#include <__type_traits/is_primary_template.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_referenceable.h>
#include <__type_traits/is_valid_expansion.h>
#include <__type_traits/remove_cv.h>
#include <__type_traits/remove_cvref.h>
Expand Down Expand Up @@ -117,15 +117,12 @@ template <class _Tp>
concept __signed_integer_like = signed_integral<_Tp>;

template <class _Ip>
concept weakly_incrementable =
// TODO: remove this once the clang bug is fixed (https://llvm.org/PR48173).
!same_as<_Ip, bool> && // Currently, clang does not handle bool correctly.
movable<_Ip> && requires(_Ip __i) {
typename iter_difference_t<_Ip>;
requires __signed_integer_like<iter_difference_t<_Ip>>;
{ ++__i } -> same_as<_Ip&>; // not required to be equality-preserving
__i++; // not required to be equality-preserving
};
concept weakly_incrementable = movable<_Ip> && requires(_Ip __i) {
typename iter_difference_t<_Ip>;
requires __signed_integer_like<iter_difference_t<_Ip>>;
{ ++__i } -> same_as<_Ip&>; // not required to be equality-preserving
__i++; // not required to be equality-preserving
};

// [iterator.concept.inc]
template <class _Ip>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__iterator/iter_move.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#define _LIBCPP___ITERATOR_ITER_MOVE_H

#include <__concepts/class_or_enum.h>
#include <__concepts/referenceable.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_referenceable.h>
#include <__type_traits/remove_cvref.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__iterator/iterator_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <__concepts/convertible_to.h>
#include <__concepts/copyable.h>
#include <__concepts/equality_comparable.h>
#include <__concepts/referenceable.h>
#include <__concepts/same_as.h>
#include <__concepts/totally_ordered.h>
#include <__config>
Expand All @@ -32,7 +33,6 @@
#include <__type_traits/is_object.h>
#include <__type_traits/is_primary_template.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_referenceable.h>
#include <__type_traits/nat.h>
#include <__type_traits/remove_const.h>
#include <__type_traits/remove_cv.h>
Expand Down
15 changes: 4 additions & 11 deletions libcxx/include/__math/traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,26 @@ namespace __math {

// signbit

// TODO(LLVM 22): Remove conditional once support for Clang 19 is dropped.
#if defined(_LIBCPP_COMPILER_GCC) || __has_constexpr_builtin(__builtin_signbit)
# define _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_CONSTEXPR_SINCE_CXX23
#else
# define _LIBCPP_SIGNBIT_CONSTEXPR
#endif

// The universal C runtime (UCRT) in the WinSDK provides floating point overloads
// for std::signbit(). By defining our overloads as templates, we can work around
// this issue as templates are less preferred than non-template functions.
template <class = void>
[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(float __x) _NOEXCEPT {
[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(float __x) _NOEXCEPT {
return __builtin_signbit(__x);
}

template <class = void>
[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(double __x) _NOEXCEPT {
[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(double __x) _NOEXCEPT {
return __builtin_signbit(__x);
}

template <class = void>
[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(long double __x) _NOEXCEPT {
[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(long double __x) _NOEXCEPT {
return __builtin_signbit(__x);
}

template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT {
[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT {
return __x < 0;
}

Expand Down
5 changes: 2 additions & 3 deletions libcxx/include/__ranges/transform_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#include <__compare/three_way_comparable.h>
#include <__concepts/constructible.h>
#include <__concepts/convertible_to.h>
#include <__concepts/copyable.h>
#include <__concepts/derived_from.h>
#include <__concepts/equality_comparable.h>
#include <__concepts/invocable.h>
#include <__concepts/referenceable.h>
#include <__config>
#include <__functional/bind_back.h>
#include <__functional/invoke.h>
Expand All @@ -38,7 +38,6 @@
#include <__type_traits/is_nothrow_constructible.h>
#include <__type_traits/is_object.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_referenceable.h>
#include <__type_traits/maybe_const.h>
#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
Expand All @@ -64,7 +63,7 @@ concept __regular_invocable_with_range_ref = regular_invocable<_Fn, range_refere
template <class _View, class _Fn>
concept __transform_view_constraints =
view<_View> && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_View>> &&
__is_referenceable_v<invoke_result_t<_Fn&, range_reference_t<_View>>>;
__referenceable<invoke_result_t<_Fn&, range_reference_t<_View>>>;

# if _LIBCPP_STD_VER >= 23
template <input_range _View, move_constructible _Fn>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__ranges/zip_transform_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <__concepts/derived_from.h>
#include <__concepts/equality_comparable.h>
#include <__concepts/invocable.h>
#include <__concepts/referenceable.h>
#include <__functional/invoke.h>
#include <__iterator/concepts.h>
#include <__iterator/incrementable_traits.h>
Expand All @@ -33,7 +34,6 @@
#include <__type_traits/invoke.h>
#include <__type_traits/is_object.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_referenceable.h>
#include <__type_traits/maybe_const.h>
#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
Expand Down
12 changes: 0 additions & 12 deletions libcxx/include/__tree
Original file line number Diff line number Diff line change
Expand Up @@ -823,18 +823,6 @@ public:
using __node_allocator _LIBCPP_NODEBUG = __rebind_alloc<__alloc_traits, __node>;
using __node_traits _LIBCPP_NODEBUG = allocator_traits<__node_allocator>;

// TODO(LLVM 22): Remove this check
#ifndef _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
static_assert(sizeof(__node_base_pointer) == sizeof(__end_node_pointer) && _LIBCPP_ALIGNOF(__node_base_pointer) ==
_LIBCPP_ALIGNOF(__end_node_pointer),
"It looks like you are using std::__tree (an implementation detail for (multi)map/set) with a fancy "
"pointer type that thas a different representation depending on whether it points to a __tree base "
"pointer or a __tree node pointer (both of which are implementation details of the standard library). "
"This means that your ABI is being broken between LLVM 19 and LLVM 20. If you don't care about your "
"ABI being broken, define the _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB macro to silence this "
"diagnostic.");
#endif

private:
// check for sane allocator pointer rebinding semantics. Rebinding the
// allocator for a new pointer type should be exactly the same as rebinding
Expand Down
Loading
Loading