LLVM  6.0.0svn
Public Member Functions | Public Attributes | List of all members
llvm::hashing::detail::hash_combine_recursive_helper Struct Reference

Helper class to manage the recursive combining of hash_combine arguments. More...

#include "llvm/ADT/Hashing.h"

Collaboration diagram for llvm::hashing::detail::hash_combine_recursive_helper:
Collaboration graph
[legend]

Public Member Functions

 hash_combine_recursive_helper ()
 Construct a recursive hash combining helper. More...
 
template<typename T >
charcombine_data (size_t &length, char *buffer_ptr, char *buffer_end, T data)
 Combine one chunk of data into the current in-flight hash. More...
 
template<typename T , typename ... Ts>
hash_code combine (size_t length, char *buffer_ptr, char *buffer_end, const T &arg, const Ts &...args)
 Recursive, variadic combining method. More...
 
hash_code combine (size_t length, char *buffer_ptr, char *buffer_end)
 Base case for recursive, variadic combining. More...
 

Public Attributes

char buffer [64]
 
hash_state state
 
const size_t seed
 

Detailed Description

Helper class to manage the recursive 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.

Definition at line 496 of file Hashing.h.

Constructor & Destructor Documentation

◆ hash_combine_recursive_helper()

llvm::hashing::detail::hash_combine_recursive_helper::hash_combine_recursive_helper ( )
inline

Construct a recursive hash combining helper.

This sets up the state for a recursive hash combine, including getting the seed and buffer setup.

Definition at line 506 of file Hashing.h.

Member Function Documentation

◆ combine() [1/2]

template<typename T , typename ... Ts>
hash_code llvm::hashing::detail::hash_combine_recursive_helper::combine ( size_t  length,
char buffer_ptr,
char buffer_end,
const T arg,
const Ts &...  args 
)
inline

Recursive, variadic combining method.

This function recurses through each argument, combining that argument into a single hash.

Definition at line 555 of file Hashing.h.

References llvm::get_hashable_data().

Referenced by llvm::hash_combine().

◆ combine() [2/2]

hash_code llvm::hashing::detail::hash_combine_recursive_helper::combine ( size_t  length,
char buffer_ptr,
char buffer_end 
)
inline

Base case for recursive, variadic combining.

The base case when combining arguments recursively is reached when all arguments have been handled. It flushes the remaining buffer and constructs a hash_code.

Definition at line 568 of file Hashing.h.

References llvm::hashing::detail::hash_state::finalize(), llvm::hashing::detail::hash_short(), llvm::hashing::detail::hash_state::mix(), and rotate.

◆ combine_data()

template<typename T >
char* llvm::hashing::detail::hash_combine_recursive_helper::combine_data ( size_t length,
char buffer_ptr,
char buffer_end,
T  data 
)
inline

Combine one chunk of data into the current in-flight hash.

This merges one chunk of data into the hash. First it tries to buffer the data. If the buffer is full, it hashes the buffer into its hash_state, empties it, and then merges the new chunk in. This also handles cases where the data straddles the end of the buffer.

Definition at line 516 of file Hashing.h.

References llvm::hashing::detail::hash_state::create(), llvm::hashing::detail::hash_state::mix(), llvm::hashing::detail::store_and_advance(), and T.

Member Data Documentation

◆ buffer

char llvm::hashing::detail::hash_combine_recursive_helper::buffer[64]

Definition at line 497 of file Hashing.h.

Referenced by llvm::hash_combine().

◆ seed

const size_t llvm::hashing::detail::hash_combine_recursive_helper::seed

Definition at line 499 of file Hashing.h.

◆ state

hash_state llvm::hashing::detail::hash_combine_recursive_helper::state

Definition at line 498 of file Hashing.h.


The documentation for this struct was generated from the following file: