[llvm] [ADT] Use a C++17 fold expression in hash_combine (NFC) (PR #159901)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 20 07:29:02 PDT 2025


================
@@ -541,21 +542,14 @@ struct hash_combine_recursive_helper {
   ///
   /// This function recurses through each argument, combining that argument
   /// into a single hash.
-  template <typename T, typename ...Ts>
+  template <typename... Ts>
   hash_code combine(size_t length, char *buffer_ptr, char *buffer_end,
-                    const T &arg, const Ts &...args) {
-    buffer_ptr = combine_data(length, buffer_ptr, buffer_end, get_hashable_data(arg));
+                    const Ts &...args) {
+    (combine_data(length, buffer_ptr, buffer_end, get_hashable_data(args)),
----------------
kuhar wrote:

Maybe be explicit about discarding the return value?
```suggestion
    ((void)combine_data(length, buffer_ptr, buffer_end, get_hashable_data(args)),
```

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


More information about the llvm-commits mailing list