Go to the documentation of this file.
9 #ifndef LLDB_CORE_MAPPEDHASH_H
10 #define LLDB_CORE_MAPPEDHASH_H
22 #include "llvm/Support/DJB.h"
32 switch (hash_function) {
34 return llvm::djbHash(s);
39 llvm_unreachable(
"Invalid hash function index");
45 template <
typename T>
struct Header {
139 template <
typename __KeyType,
class __HeaderType,
class __HashData>
204 bool Find(llvm::StringRef name, Pair &pair)
const {
213 const uint32_t bucket_idx = hash_value % bucket_count;
215 if (hash_idx < hash_count) {
216 for (; hash_idx < hash_count; ++hash_idx) {
218 if (curr_hash_value == hash_value) {
225 switch (hash_result) {
230 if (prev_hash_data_offset == hash_data_offset)
244 if ((curr_hash_value % bucket_count) != bucket_idx)
279 Pair &pair)
const = 0;
284 std::function<
bool(
const HashData &hash_data)>
const &callback)
const {
285 const size_t num_hash_offsets =
m_header.hashes_count;
286 for (
size_t i = 0; i < num_hash_offsets; ++i) {
292 if (callback(hash_data) ==
false)
308 #endif // LLDB_CORE_MAPPEDHASH_H
virtual Result GetHashDataForName(llvm::StringRef name, lldb::offset_t *hash_data_offset_ptr, Pair &pair) const =0
uint32_t GetHashIndex(uint32_t bucket_idx) const
MemoryTable(lldb_private::DataExtractor &data)
virtual bool ReadHashData(uint32_t hash_data_offset, HashData &hash_data) const =0
virtual ~MemoryTable()=default
uint32_t GetHashValue(uint32_t hash_idx) const
const HeaderType & GetHeader()
void ForEach(std::function< bool(const HashData &hash_data)> const &callback) const
const uint32_t * m_hash_values
uint32_t GetHashDataOffset(uint32_t hash_idx) const
static uint32_t HashString(uint32_t hash_function, llvm::StringRef s)
#define LLDB_INVALID_OFFSET
static const uint32_t HASH_CIGAM
const uint32_t * m_hash_indexes
bool Find(llvm::StringRef name, Pair &pair) const
virtual const char * GetStringForKeyType(KeyType key) const =0
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
static const uint32_t HASH_MAGIC
const uint32_t * m_hash_offsets