26 m_map.Sort(std::less<DIERef>());
31 m_map.Append(name, die_ref);
35 llvm::function_ref<
bool(
DIERef ref)> callback)
const {
36 for (
const auto &entry :
m_map.equal_range(name))
37 if (!callback(entry.value))
43 llvm::function_ref<
bool(
DIERef ref)> callback)
const {
44 for (
const auto &entry :
m_map)
45 if (regex.
Execute(entry.cstring.GetCString())) {
46 if (!callback(entry.value))
53 DWARFUnit &s_unit, llvm::function_ref<
bool(
DIERef ref)> callback)
const {
55 const uint32_t size =
m_map.GetSize();
56 for (uint32_t i = 0; i < size; ++i) {
57 const DIERef &die_ref =
m_map.GetValueAtIndexUnchecked(i);
62 if (!callback(die_ref))
69 const uint32_t size =
m_map.GetSize();
70 for (uint32_t i = 0; i < size; ++i) {
71 s->
Format(
"{0} \"{1}\"\n",
m_map.GetValueAtIndexUnchecked(i),
72 m_map.GetCStringAtIndexUnchecked(i));
79 const uint32_t size =
m_map.GetSize();
80 for (uint32_t i = 0; i < size; ++i) {
81 if (!callback(
m_map.GetCStringAtIndexUnchecked(i),
82 m_map.GetValueAtIndexUnchecked(i)))
88 const uint32_t size = other.
m_map.GetSize();
89 for (uint32_t i = 0; i < size; ++i) {
90 m_map.Append(other.
m_map.GetCStringAtIndexUnchecked(i),
91 other.
m_map.GetValueAtIndexUnchecked(i));
100 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
103 const uint32_t count = data.
GetU32(offset_ptr);
104 m_map.Reserve(count);
105 for (uint32_t i = 0; i < count; ++i) {
106 llvm::StringRef str(strtab.
Get(data.
GetU32(offset_ptr)));
110 if (std::optional<DIERef> die_ref =
DIERef::Decode(data, offset_ptr))
124 m_map.Sort(std::less<DIERef>());
131 for (
const auto &entry :
m_map) {
133 assert((
bool)entry.cstring);
135 entry.value.Encode(encoder);
140 const size_t size =
m_map.GetSize();
141 if (size != rhs.
m_map.GetSize())
143 for (
size_t i = 0; i < size; ++i) {
144 if (
m_map.GetCStringAtIndex(i) != rhs.
m_map.GetCStringAtIndex(i))
146 if (
m_map.GetValueRefAtIndexUnchecked(i) !=
147 rhs.
m_map.GetValueRefAtIndexUnchecked(i))
constexpr llvm::StringLiteral kIdentifierNameToDIE("N2DI")
Many cache files require string tables to store data efficiently.
uint32_t Add(ConstString s)
Add a string into the string table.
A uniqued constant string class.
An binary data encoding class.
void AppendU32(uint32_t value)
void AppendData(llvm::StringRef data)
Append a bytes to the end of the owned data.
bool Execute(llvm::StringRef string, llvm::SmallVectorImpl< llvm::StringRef > *matches=nullptr) const
Execute a regular expression match using the compiled regular expression that is already in this obje...
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
Many cache files require string tables to store data efficiently.
llvm::StringRef Get(uint32_t offset) const
Identifies a DWARF debug info entry within a given Module.
std::optional< uint32_t > file_index() const
static std::optional< DIERef > Decode(const DataExtractor &data, lldb::offset_t *offset_ptr)
Decode a serialized version of this object from data.
dw_offset_t die_offset() const
SymbolFileDWARF & GetSymbolFileDWARF() const
DIERef::Section GetDebugSection() const
dw_offset_t GetOffset() const
dw_offset_t GetNextUnitOffset() const
DWARFUnit & GetNonSkeletonUnit()
void Append(const NameToDIE &other)
void FindAllEntriesForUnit(DWARFUnit &unit, llvm::function_ref< bool(DIERef ref)> callback) const
unit must be the skeleton unit if possible, not GetNonSkeletonUnit().
bool Decode(const DataExtractor &data, lldb::offset_t *offset_ptr, const StringTableReader &strtab)
Decode a serialized version of this object from data.
bool Find(ConstString name, llvm::function_ref< bool(DIERef ref)> callback) const
void Insert(ConstString name, const DIERef &die_ref)
bool operator==(const NameToDIE &rhs) const
Used for unit testing the encoding and decoding.
void Encode(DataEncoder &encoder, ConstStringTable &strtab) const
Encode this object into a data encoder object.
void ForEach(std::function< bool(ConstString name, const DIERef &die_ref)> const &callback) const
UniqueCStringMap< DIERef > m_map
std::optional< uint64_t > GetFileIndex() const
A class that represents a running process on the host machine.