[libcxx-commits] [libcxx] [libc++] Address most LLVM23 TODOs (PR #199397)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat May 23 22:42:15 PDT 2026


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/199397

There is still on LLVM23 TODO left that can only be resolved one we update GCC.


>From f119d25abc5d753e8fbfa4eba9b5169668196a01 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sun, 24 May 2026 07:41:11 +0200
Subject: [PATCH] [libc++] Address most LLVM23 TODOs

There is still on LLVM23 TODO left that can only be resolved one we update GCC.
---
 libcxx/include/__configuration/hardening.h | 17 -----------------
 libcxx/include/string                      | 14 ++------------
 libcxx/include/tuple                       |  7 +------
 3 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/libcxx/include/__configuration/hardening.h b/libcxx/include/__configuration/hardening.h
index 5723f5a65e1bf..1c5d59c5ced4a 100644
--- a/libcxx/include/__configuration/hardening.h
+++ b/libcxx/include/__configuration/hardening.h
@@ -17,23 +17,6 @@
 #  pragma GCC system_header
 #endif
 
-// TODO(LLVM 23): Remove this. We're making these an error to catch folks who might not have migrated.
-//       Since hardening went through several changes (many of which impacted user-facing macros),
-//       we're keeping these checks around for a bit longer than usual. Failure to properly configure
-//       hardening results in checks being dropped silently, which is a pretty big deal.
-#if defined(_LIBCPP_ENABLE_ASSERTIONS)
-#  error "_LIBCPP_ENABLE_ASSERTIONS has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
-#endif
-#if defined(_LIBCPP_ENABLE_HARDENED_MODE)
-#  error "_LIBCPP_ENABLE_HARDENED_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
-#endif
-#if defined(_LIBCPP_ENABLE_SAFE_MODE)
-#  error "_LIBCPP_ENABLE_SAFE_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
-#endif
-#if defined(_LIBCPP_ENABLE_DEBUG_MODE)
-#  error "_LIBCPP_ENABLE_DEBUG_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
-#endif
-
 // The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values:
 //
 // - `_LIBCPP_HARDENING_MODE_NONE`;
diff --git a/libcxx/include/string b/libcxx/include/string
index 2455938a92d9c..fab6b08ffce66 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -940,12 +940,7 @@ public:
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string()
       _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
-#  if _LIBCPP_STD_VER >= 20 // TODO(LLVM 23): Remove this condition; this is a workaround for https://llvm.org/PR154567
-      : __rep_(__short())
-#  else
-      : __rep_()
-#  endif
-  {
+      : __rep_() {
     __annotate_new(0);
   }
 
@@ -955,12 +950,7 @@ public:
 #  else
       _NOEXCEPT
 #  endif
-#  if _LIBCPP_STD_VER >= 20 // TODO(LLVM 23): Remove this condition; this is a workaround for https://llvm.org/PR154567
-      : __rep_(__short()),
-#  else
-      : __rep_(),
-#  endif
-        __alloc_(__a) {
+      : __rep_(), __alloc_(__a) {
     __annotate_new(0);
   }
 
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index e02e45f425f4f..3e8e7c902ef26 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -300,10 +300,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __tuple_compare_equal(c
 template <class _Tp, class _Up, class _IndexSeq = make_index_sequence<tuple_size_v<_Tp>>>
 inline constexpr bool __can_tuple_compare_equal = false;
 
-// TODO(LLVM 23): Remove `tuple_size_v<_Tp> == tuple_size_v<_Up>` here once once LLVM-20 support ends
-// because the resolution of CWG2369 landed in LLVM-21.
 template <class _Tp, class _Up, size_t... _Is>
-  requires(tuple_size_v<_Tp> == tuple_size_v<_Up>)
 inline constexpr bool __can_tuple_compare_equal<_Tp, _Up, index_sequence<_Is...>> =
     __all<requires(const tuple_element_t<_Is, _Tp>& __t, const tuple_element_t<_Is, _Up>& __u) {
       { __t == __u } -> __boolean_testable;
@@ -327,10 +324,8 @@ concept __tuple_like_no_tuple = __tuple_like<_Tp> && !__is_tuple_v<_Tp>;
 template <class _Tp, class _Up, class _IndexSeq>
 struct __tuple_common_comparison_category_impl {};
 
-// TODO(LLVM 23): Remove `tuple_size_v<_Tp> == tuple_size_v<_Up>` here once once LLVM-20 support ends
-// because the resolution of CWG2369 landed in LLVM-21.
 template <class _Tp, class _Up, size_t... _Is>
-  requires(tuple_size_v<_Tp> == tuple_size_v<_Up>) && requires {
+  requires requires {
     typename common_comparison_category_t<
         __synth_three_way_result<tuple_element_t<_Is, _Tp>, tuple_element_t<_Is, _Up>>...>;
   }



More information about the libcxx-commits mailing list