Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Language/ObjC/CFBasicHash.h
39644 views
//===-- CFBasicHash.h -------------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_CFBASICHASH_H9#define LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_CFBASICHASH_H1011#include "lldb/Target/Process.h"12#include "lldb/Target/Target.h"1314namespace lldb_private {1516class CFBasicHash {17public:18enum class HashType { set = 0, dict };1920CFBasicHash() = default;21~CFBasicHash() = default;2223bool Update(lldb::addr_t addr, ExecutionContextRef exe_ctx_rf);2425bool IsValid() const;2627bool IsMutable() const { return m_mutable; };28bool IsMultiVariant() const { return m_multi; }29HashType GetType() const { return m_type; }3031size_t GetCount() const;32lldb::addr_t GetKeyPointer() const;33lldb::addr_t GetValuePointer() const;3435private:36template <typename T> struct __CFBasicHash {37struct RuntimeBase {38T cfisa;39T cfinfoa;40} base;4142struct Bits {43uint16_t __reserved0;44uint16_t __reserved1 : 2;45uint16_t keys_offset : 1;46uint16_t counts_offset : 2;47uint16_t counts_width : 2;48uint16_t __reserved2 : 9;49uint32_t used_buckets; // number of used buckets50uint64_t deleted : 16; // number of elements deleted51uint64_t num_buckets_idx : 8; // index to number of buckets52uint64_t __reserved3 : 40;53uint64_t __reserved4;54} bits;5556T pointers[3];57};58template <typename T> bool UpdateFor(std::unique_ptr<__CFBasicHash<T>> &m_ht);5960size_t GetPointerCount() const;6162uint32_t m_ptr_size = UINT32_MAX;63lldb::ByteOrder m_byte_order = lldb::eByteOrderInvalid;64Address m_address = LLDB_INVALID_ADDRESS;65std::unique_ptr<__CFBasicHash<uint32_t>> m_ht_32 = nullptr;66std::unique_ptr<__CFBasicHash<uint64_t>> m_ht_64 = nullptr;67ExecutionContextRef m_exe_ctx_ref;68bool m_mutable = true;69bool m_multi = false;70HashType m_type = HashType::set;71};7273} // namespace lldb_private7475#endif // LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_CFBASICHASH_H767778