[libcxx-commits] [libcxx] [libc++] Avoid key_eq calls in hash_table rehash (PR #216551)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 16 02:01:16 PDT 2026


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 origin/main HEAD --extensions  -- libcxx/include/__hash_table --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</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 55a520a81..d2ce69fda 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -1773,8 +1773,7 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __bucket_co
       } else {
         __next_pointer __np = __cp;
         if _LIBCPP_CONSTEXPR (!_UniqueKeys) {
-          for (; __np->__next_ != nullptr && __cp->__hash() == __np->__next_->__hash();
-               __np = __np->__next_)
+          for (; __np->__next_ != nullptr && __cp->__hash() == __np->__next_->__hash(); __np = __np->__next_)
             ;
         }
         __pp->__next_                    = __np->__next_;

``````````

</details>


https://github.com/llvm/llvm-project/pull/216551


More information about the libcxx-commits mailing list