[libcxx-commits] [libcxx] [libc++] Avoid type-punning betwee __hash_value_type and pair (PR #143501)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 10 03:02:07 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions -- libcxx/include/__hash_table libcxx/include/unordered_map
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index b8fe848e6..91d32590b 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -123,7 +123,7 @@ using __get_hash_node_value_type_t = typename __get_hash_node_value_type<_Tp>::t
template <class _Tp, class _VoidPtr>
struct __hash_node : public __hash_node_base< __rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > > {
- using __node_value_type = __get_hash_node_value_type_t<_Tp>;
+ using __node_value_type = __get_hash_node_value_type_t<_Tp>;
using _Base _LIBCPP_NODEBUG = __hash_node_base<__rebind_pointer_t<_VoidPtr, __hash_node<_Tp, _VoidPtr> > >;
using __next_pointer _LIBCPP_NODEBUG = typename _Base::__next_pointer;
@@ -146,7 +146,9 @@ private:
_ALIGNAS_TYPE(__node_value_type) char __buffer_[sizeof(__node_value_type)];
public:
- _LIBCPP_HIDE_FROM_ABI __node_value_type& __get_value() { return *std::__launder(reinterpret_cast<__node_value_type*>(&__buffer_)); }
+ _LIBCPP_HIDE_FROM_ABI __node_value_type& __get_value() {
+ return *std::__launder(reinterpret_cast<__node_value_type*>(&__buffer_));
+ }
#endif
_LIBCPP_HIDE_FROM_ABI explicit __hash_node(__next_pointer __next, size_t __hash) : _Base(__next), __hash_(__hash) {}
``````````
</details>
https://github.com/llvm/llvm-project/pull/143501
More information about the libcxx-commits
mailing list