27 m_map.Sort(std::less<DIERef>());
32 m_map.Append(name, die_ref);
38 for (
const auto &entry :
m_map.equal_range(name))
47 for (
const auto &entry :
m_map)
48 if (regex.
Execute(entry.cstring.GetCString())) {
59 const uint32_t size =
m_map.GetSize();
60 for (uint32_t i = 0; i < size; ++i) {
61 const DIERef &die_ref =
m_map.GetValueAtIndexUnchecked(i);
73 const uint32_t size =
m_map.GetSize();
74 for (uint32_t i = 0; i < size; ++i) {
75 s->
Format(
"{0} \"{1}\"\n",
m_map.GetValueAtIndexUnchecked(i),
76 m_map.GetCStringAtIndexUnchecked(i));
83 const uint32_t size =
m_map.GetSize();
84 for (uint32_t i = 0; i < size; ++i) {
85 if (!callback(
m_map.GetCStringAtIndexUnchecked(i),
86 m_map.GetValueAtIndexUnchecked(i)))
92 const uint32_t size = other.
m_map.GetSize();
93 for (uint32_t i = 0; i < size; ++i) {
94 m_map.Append(other.
m_map.GetCStringAtIndexUnchecked(i),
95 other.
m_map.GetValueAtIndexUnchecked(i));
104 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
107 const uint32_t count = data.
GetU32(offset_ptr);
108 m_map.Reserve(count);
109 for (uint32_t i = 0; i < count; ++i) {
110 llvm::StringRef str(strtab.
Get(data.
GetU32(offset_ptr)));
114 if (std::optional<DIERef> die_ref =
DIERef::Decode(data, offset_ptr))
128 m_map.Sort(std::less<DIERef>());
135 for (
const auto &entry :
m_map) {
137 assert((
bool)entry.cstring);
139 entry.value.Encode(encoder);
144 const size_t size =
m_map.GetSize();
145 if (size != rhs.
m_map.GetSize())
147 for (
size_t i = 0; i < size; ++i) {
148 if (
m_map.GetCStringAtIndex(i) != rhs.
m_map.GetCStringAtIndex(i))
150 if (
m_map.GetValueRefAtIndexUnchecked(i) !=
151 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)
bool Find(ConstString name, llvm::function_ref< IterationAction(DIERef ref)> callback) const
bool Decode(const DataExtractor &data, lldb::offset_t *offset_ptr, const StringTableReader &strtab)
Decode a serialized version of this object from data.
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
void FindAllEntriesForUnit(DWARFUnit &unit, llvm::function_ref< IterationAction(DIERef ref)> callback) const
unit must be the skeleton unit if possible, not GetNonSkeletonUnit().
std::optional< uint64_t > GetFileIndex() const
A class that represents a running process on the host machine.
IterationAction
Useful for callbacks whose return type indicates whether to continue iteration or short-circuit.