Skip to content

Commit 5039937

Browse files
committed
[libc++] Fix LLVM 22 TODOs
1 parent d30bd27 commit 5039937

33 files changed

+47
-214
lines changed

libcxx/include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,8 @@ set(files
854854
__type_traits/is_polymorphic.h
855855
__type_traits/is_primary_template.h
856856
__type_traits/is_reference.h
857-
__type_traits/is_reference_wrapper.h
858857
__type_traits/is_referenceable.h
858+
__type_traits/is_reference_wrapper.h
859859
__type_traits/is_replaceable.h
860860
__type_traits/is_same.h
861861
__type_traits/is_scalar.h

libcxx/include/__config

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,7 @@ typedef __char32_t char32_t;
10501050
# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "")
10511051
# endif
10521052

1053-
// TODO(LLVM 22): Remove the workaround
1054-
# if defined(__OBJC__) && (!defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER < 2001)
1053+
# if defined(__OBJC__) && defined(_LIBCPP_APPLE_CLANG_VER)
10551054
# define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS
10561055
# endif
10571056

@@ -1255,14 +1254,6 @@ typedef __char32_t char32_t;
12551254
# define _LIBCPP_DIAGNOSE_NULLPTR
12561255
# endif
12571256

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

12681259
#endif // _LIBCPP___CONFIG

libcxx/include/__configuration/abi.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@
6161
// According to the Standard, `bitset::operator[] const` returns bool
6262
# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
6363

64-
// In LLVM 20, we've changed to take these ABI breaks unconditionally. These flags only exist in case someone is running
65-
// into the static_asserts we added to catch the ABI break and don't care that it is one.
66-
// TODO(LLVM 22): Remove these flags
67-
# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
68-
# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
69-
# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
70-
# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
71-
7264
// These flags are documented in ABIGuarantees.rst
7365
# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
7466
# define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON

libcxx/include/__format/format_arg.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_
149149
__libcpp_unreachable();
150150
}
151151

152-
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
152+
# if _LIBCPP_STD_VER >= 26
153153

154154
template <class _Rp, class _Visitor, class _Context>
155155
_LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
@@ -200,7 +200,7 @@ _LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<
200200
__libcpp_unreachable();
201201
}
202202

203-
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
203+
# endif // _LIBCPP_STD_VER >= 26
204204

205205
/// Contains the values used in basic_format_arg.
206206
///
@@ -285,7 +285,7 @@ class _LIBCPP_NO_SPECIALIZATIONS basic_format_arg {
285285

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

288-
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
288+
# if _LIBCPP_STD_VER >= 26
289289

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

332-
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
332+
# endif // _LIBCPP_STD_VER >= 26
333333

334334
private:
335335
using char_type = typename _Context::char_type;
@@ -371,11 +371,8 @@ class basic_format_arg<_Context>::handle {
371371
// This function is user facing, so it must wrap the non-standard types of
372372
// the "variant" in a handle to stay conforming. See __arg_t for more details.
373373
template <class _Visitor, class _Context>
374-
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
375-
_LIBCPP_DEPRECATED_IN_CXX26
376-
# endif
377-
_LIBCPP_HIDE_FROM_ABI decltype(auto)
378-
visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
374+
_LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_HIDE_FROM_ABI decltype(auto)
375+
visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
379376
switch (__arg.__type_) {
380377
# if _LIBCPP_HAS_INT128
381378
case __format::__arg_t::__i128: {
@@ -387,7 +384,7 @@ _LIBCPP_DEPRECATED_IN_CXX26
387384
typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_};
388385
return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
389386
}
390-
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
387+
# endif // _LIBCPP_HAS_INT128
391388
default:
392389
return std::__visit_format_arg(std::forward<_Visitor>(__vis), __arg);
393390
}

libcxx/include/__format/format_context.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ class basic_format_context<typename __format::__retarget_buffer<_CharT>::__itera
175175
__format::__determine_arg_t<basic_format_context, decltype(__arg)>(),
176176
__basic_format_arg_value<basic_format_context>(__arg)};
177177
};
178-
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
178+
# if _LIBCPP_STD_VER >= 26
179179
return static_cast<_Context*>(__c)->arg(__id).visit(std::move(__visitor));
180180
# else
181181
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
182182
return std::visit_format_arg(std::move(__visitor), static_cast<_Context*>(__c)->arg(__id));
183183
_LIBCPP_SUPPRESS_DEPRECATED_POP
184-
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
184+
# endif // _LIBCPP_STD_VER >= 26
185185
}) {
186186
}
187187

libcxx/include/__hash_table

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,6 @@ struct __hash_node_base {
8383
typedef _NodePtr __node_pointer;
8484
typedef __node_base_pointer __next_pointer;
8585

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

10088
_LIBCPP_HIDE_FROM_ABI __next_pointer __ptr() _NOEXCEPT {

libcxx/include/__iterator/concepts.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,12 @@ template <class _Tp>
117117
concept __signed_integer_like = signed_integral<_Tp>;
118118

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

130127
// [iterator.concept.inc]
131128
template <class _Ip>

libcxx/include/__math/traits.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,26 @@ namespace __math {
2525

2626
// signbit
2727

28-
// TODO(LLVM 22): Remove conditional once support for Clang 19 is dropped.
29-
#if defined(_LIBCPP_COMPILER_GCC) || __has_constexpr_builtin(__builtin_signbit)
30-
# define _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_CONSTEXPR_SINCE_CXX23
31-
#else
32-
# define _LIBCPP_SIGNBIT_CONSTEXPR
33-
#endif
34-
3528
// The universal C runtime (UCRT) in the WinSDK provides floating point overloads
3629
// for std::signbit(). By defining our overloads as templates, we can work around
3730
// this issue as templates are less preferred than non-template functions.
3831
template <class = void>
39-
[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(float __x) _NOEXCEPT {
32+
[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(float __x) _NOEXCEPT {
4033
return __builtin_signbit(__x);
4134
}
4235

4336
template <class = void>
44-
[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(double __x) _NOEXCEPT {
37+
[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(double __x) _NOEXCEPT {
4538
return __builtin_signbit(__x);
4639
}
4740

4841
template <class = void>
49-
[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(long double __x) _NOEXCEPT {
42+
[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(long double __x) _NOEXCEPT {
5043
return __builtin_signbit(__x);
5144
}
5245

5346
template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
54-
[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT {
47+
[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT {
5548
return __x < 0;
5649
}
5750

libcxx/include/__ranges/transform_view.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <__compare/three_way_comparable.h>
1414
#include <__concepts/constructible.h>
1515
#include <__concepts/convertible_to.h>
16-
#include <__concepts/copyable.h>
1716
#include <__concepts/derived_from.h>
1817
#include <__concepts/equality_comparable.h>
1918
#include <__concepts/invocable.h>
@@ -64,7 +63,7 @@ concept __regular_invocable_with_range_ref = regular_invocable<_Fn, range_refere
6463
template <class _View, class _Fn>
6564
concept __transform_view_constraints =
6665
view<_View> && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_View>> &&
67-
__is_referenceable_v<invoke_result_t<_Fn&, range_reference_t<_View>>>;
66+
__referenceable<invoke_result_t<_Fn&, range_reference_t<_View>>>;
6867

6968
# if _LIBCPP_STD_VER >= 23
7069
template <input_range _View, move_constructible _Fn>

libcxx/include/__tree

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -823,18 +823,6 @@ public:
823823
using __node_allocator _LIBCPP_NODEBUG = __rebind_alloc<__alloc_traits, __node>;
824824
using __node_traits _LIBCPP_NODEBUG = allocator_traits<__node_allocator>;
825825

826-
// TODO(LLVM 22): Remove this check
827-
#ifndef _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
828-
static_assert(sizeof(__node_base_pointer) == sizeof(__end_node_pointer) && _LIBCPP_ALIGNOF(__node_base_pointer) ==
829-
_LIBCPP_ALIGNOF(__end_node_pointer),
830-
"It looks like you are using std::__tree (an implementation detail for (multi)map/set) with a fancy "
831-
"pointer type that thas a different representation depending on whether it points to a __tree base "
832-
"pointer or a __tree node pointer (both of which are implementation details of the standard library). "
833-
"This means that your ABI is being broken between LLVM 19 and LLVM 20. If you don't care about your "
834-
"ABI being broken, define the _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB macro to silence this "
835-
"diagnostic.");
836-
#endif
837-
838826
private:
839827
// check for sane allocator pointer rebinding semantics. Rebinding the
840828
// allocator for a new pointer type should be exactly the same as rebinding

0 commit comments

Comments
 (0)