Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

Now that we have removed recursion in #159901 and #159938, this patch
updates those comments that still mention recursion.

Now that we have removed recursion in llvm#159901 and llvm#159938, this patch
updates those comments that still mention recursion.
@llvmbot
Copy link
Member

llvmbot commented Sep 21, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

Now that we have removed recursion in #159901 and #159938, this patch
updates those comments that still mention recursion.


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

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/Hashing.h (+9-13)
diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index 31d7be2714a20..7d05a449c4877 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -476,13 +476,10 @@ template <typename RangeT> hash_code hash_combine_range(RangeT &&R) {
 namespace hashing {
 namespace detail {
 
-/// Helper class to manage the recursive combining of hash_combine
-/// arguments.
+/// Helper class to manage the combining of `hash_combine` arguments.
 ///
-/// This class exists to manage the state and various calls involved in the
-/// recursive combining of arguments used in hash_combine. It is particularly
-/// useful at minimizing the code in the recursive calls to ease the pain
-/// caused by a lack of variadic functions.
+/// This class manages the state and various calls involved in combining a
+/// variadic argument list into a single hash.
 struct hash_combine_helper {
   char buffer[64] = {};
   char *buffer_ptr;
@@ -492,10 +489,10 @@ struct hash_combine_helper {
   const uint64_t seed;
 
 public:
-  /// Construct a recursive hash combining helper.
+  /// Construct a hash combining helper.
   ///
-  /// This sets up the state for a recursive hash combine, including getting
-  /// the seed and buffer setup.
+  /// This sets up the state for a hash combine, including getting the seed and
+  /// buffer setup.
   hash_combine_helper()
       : buffer_ptr(buffer), buffer_end(buffer + 64),
         seed(get_execution_seed()) {}
@@ -539,10 +536,9 @@ struct hash_combine_helper {
     }
   }
 
-  /// Recursive, variadic combining method.
+  /// Variadic combining method.
   ///
-  /// This function recurses through each argument, combining that argument
-  /// into a single hash.
+  /// This function combines each argument into a single hash.
   template <typename... Ts> hash_code combine(const Ts &...args) {
     (combine_data(get_hashable_data(args)), ...);
 
@@ -582,7 +578,7 @@ struct hash_combine_helper {
 /// *implementation* for their user-defined type. Consumers of a type should
 /// *not* call this routine, they should instead call 'hash_value'.
 template <typename... Ts> hash_code hash_combine(const Ts &...args) {
-  // Recursively hash each argument using a helper class.
+  // Hash each argument using a helper class.
   ::llvm::hashing::detail::hash_combine_helper helper;
   return helper.combine(args...);
 }

@kazutakahirata
Copy link
Contributor Author

The patches to use a C++17 fold expression got reverted. Closing.

@kazutakahirata kazutakahirata deleted the cleanup_20250920_10TMP_hash_combine branch September 21, 2025 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants