[libcxx-commits] [libcxx] b08681b - [libc++] Remove unused type_info constructor (#235739)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 30 06:28:41 PDT 2026


Author: Nikolas Klauser
Date: 2026-10-30T14:28:37+01:00
New Revision: b08681ba2a1f163475ab29ae4fc66712ccb56fac

URL: https://github.com/llvm/llvm-project/commit/b08681ba2a1f163475ab29ae4fc66712ccb56fac
DIFF: https://github.com/llvm/llvm-project/commit/b08681ba2a1f163475ab29ae4fc66712ccb56fac.diff

LOG: [libc++] Remove unused type_info constructor (#235739)

We have a constructor taking a `const char*` since the initial import.
It's unused in the library and neither the C++ standard nor the Itanium
ABI require it. Since all `type_info` instances are magicked into
existence by the compiler it doesn't make a ton of sense to have a
constructor either.

Added: 
    

Modified: 
    libcxx/docs/ReleaseNotes/24.rst
    libcxx/include/typeinfo

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/ReleaseNotes/24.rst b/libcxx/docs/ReleaseNotes/24.rst
index a22d7f1a2e468e..2d02f253e3ecb1 100644
--- a/libcxx/docs/ReleaseNotes/24.rst
+++ b/libcxx/docs/ReleaseNotes/24.rst
@@ -85,6 +85,8 @@ Potentially breaking changes
   Specifically, when an exception is thrown, the appended elements are now destructed from first to last instead of
   last to first.
 
+- ``type_info`` no longer provides a protected constructor taking a ``const char*``.
+
 Announcements About Future Releases
 -----------------------------------
 

diff  --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo
index aca6b91768d095..f75daeed08fba3 100644
--- a/libcxx/include/typeinfo
+++ b/libcxx/include/typeinfo
@@ -195,10 +195,6 @@ struct __string_impl_base {
   __type_name_to_string(__type_name_t __v) _NOEXCEPT {
     return __v;
   }
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static __type_name_t
-  __string_to_type_name(const char* __v) _NOEXCEPT {
-    return __v;
-  }
 };
 
 struct __unique_impl : __string_impl_base {
@@ -234,9 +230,6 @@ struct __non_unique_arm_rtti_bit_impl {
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
     return reinterpret_cast<const char*>(__v & ~__non_unique_rtti_bit::value);
   }
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
-    return reinterpret_cast<__type_name_t>(__v);
-  }
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT {
     if (__is_type_name_unique(__v))
@@ -304,8 +297,6 @@ protected:
 
   _LIBCPP_DISABLE_POINTER_FIELD_PROTECTION __impl::__type_name_t __type_name;
 
-  _LIBCPP_HIDE_FROM_ABI explicit type_info(const char* __n) : __type_name(__impl::__string_to_type_name(__n)) {}
-
 public:
   virtual ~type_info();
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char* name() const _NOEXCEPT {


        


More information about the libcxx-commits mailing list