Skip to content

Conversation

@philnik777
Copy link
Contributor

We're not instantiating __hash_value_type anymore, so we don't need any special handling of it here.

@philnik777 philnik777 marked this pull request as ready for review July 9, 2025 11:18
@philnik777 philnik777 requested a review from a team as a code owner July 9, 2025 11:18
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jul 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

We're not instantiating __hash_value_type anymore, so we don't need any special handling of it here.


Full diff: https://github.com/llvm/llvm-project/pull/147271.diff

1 Files Affected:

  • (modified) libcxx/include/__node_handle (+4-27)
diff --git a/libcxx/include/__node_handle b/libcxx/include/__node_handle
index 5c559c657ef50..b20b0c73a0518 100644
--- a/libcxx/include/__node_handle
+++ b/libcxx/include/__node_handle
@@ -174,40 +174,17 @@ struct __set_node_handle_specifics {
   _LIBCPP_HIDE_FROM_ABI value_type& value() const { return static_cast<_Derived const*>(this)->__ptr_->__get_value(); }
 };
 
-template <class, class>
-struct __hash_value_type;
-
 template <class _NodeType, class _Derived>
 struct __map_node_handle_specifics {
-  template <class _Tp>
-  struct __get_type {
-    using key_type    = __remove_const_t<typename _Tp::first_type>;
-    using mapped_type = typename _Tp::second_type;
-  };
-
-  template <class _Key, class _Mapped>
-  struct __get_type<__hash_value_type<_Key, _Mapped> > {
-    using key_type    = _Key;
-    using mapped_type = _Mapped;
-  };
-
-  using key_type    = typename __get_type<typename _NodeType::__node_value_type>::key_type;
-  using mapped_type = typename __get_type<typename _NodeType::__node_value_type>::mapped_type;
+  using key_type    = __remove_const_t<typename _NodeType::__node_value_type::first_type>;
+  using mapped_type = typename _NodeType::__node_value_type::second_type;
 
   _LIBCPP_HIDE_FROM_ABI key_type& key() const {
-    if constexpr (__is_specialization_v<typename _NodeType::__node_value_type, __hash_value_type>) {
-      return static_cast<_Derived const*>(this)->__ptr_->__get_value().__ref().first;
-    } else {
-      return const_cast<key_type&>(static_cast<_Derived const*>(this)->__ptr_->__get_value().first);
-    }
+    return const_cast<key_type&>(static_cast<_Derived const*>(this)->__ptr_->__get_value().first);
   }
 
   _LIBCPP_HIDE_FROM_ABI mapped_type& mapped() const {
-    if constexpr (__is_specialization_v<typename _NodeType::__node_value_type, __hash_value_type>) {
-      return static_cast<_Derived const*>(this)->__ptr_->__get_value().__ref().second;
-    } else {
-      return static_cast<_Derived const*>(this)->__ptr_->__get_value().second;
-    }
+    return static_cast<_Derived const*>(this)->__ptr_->__get_value().second;
   }
 };
 

@philnik777 philnik777 merged commit 28f0935 into llvm:main Jul 10, 2025
137 of 145 checks passed
@philnik777 philnik777 deleted the simplify_node_handle branch July 10, 2025 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants