22void DWARFAbbreviationDeclarationSet::clear() {
31 const uint64_t BeginOffset = *OffsetPtr;
36 if (FirstAbbrCode == 0) {
37 FirstAbbrCode = AbbrDecl.
getCode();
39 if (PrevAbbrCode + 1 != AbbrDecl.
getCode()) {
41 FirstAbbrCode = UINT32_MAX;
44 PrevAbbrCode = AbbrDecl.
getCode();
45 Decls.push_back(std::move(AbbrDecl));
47 return BeginOffset != *OffsetPtr;
51 for (
const auto &Decl : Decls)
58 if (FirstAbbrCode == UINT32_MAX) {
59 for (
const auto &Decl : Decls) {
60 if (Decl.getCode() == AbbrCode)
65 if (AbbrCode < FirstAbbrCode || AbbrCode >= FirstAbbrCode + Decls.size())
67 return &Decls[AbbrCode - FirstAbbrCode];
72 std::vector<uint32_t> Codes;
73 Codes.reserve(Decls.size());
74 for (
const auto &Decl : Decls)
75 Codes.push_back(Decl.getCode());
81 for (
auto Current = Codes.begin(), End = Codes.end(); Current != End;) {
87 while (++Current != End && *Current == RangeEnd + 1)
90 if (RangeStart != RangeEnd)
91 Stream <<
"-" << RangeEnd;
101void DWARFDebugAbbrev::clear() {
102 AbbrDeclSets.clear();
103 PrevAbbrOffsetPos = AbbrDeclSets.end();
115 auto I = AbbrDeclSets.begin();
116 while (Data->isValidOffset(
Offset)) {
117 while (
I != AbbrDeclSets.end() &&
I->first <
Offset)
123 AbbrDeclSets.insert(
I, std::make_pair(CUAbbrOffset, std::move(AbbrDecls)));
131 if (AbbrDeclSets.empty()) {
136 for (
const auto &
I : AbbrDeclSets) {
137 OS <<
format(
"Abbrev table for offset: 0x%8.8" PRIx64
"\n",
I.first);
144 const auto End = AbbrDeclSets.end();
145 if (PrevAbbrOffsetPos != End && PrevAbbrOffsetPos->first == CUAbbrOffset) {
146 return &(PrevAbbrOffsetPos->second);
149 const auto Pos = AbbrDeclSets.find(CUAbbrOffset);
151 PrevAbbrOffsetPos = Pos;
152 return &(Pos->second);
155 if (Data && CUAbbrOffset < Data->getData().size()) {
161 AbbrDeclSets.insert(std::make_pair(CUAbbrOffset, std::move(AbbrDecls)))
163 return &PrevAbbrOffsetPos->second;
void dump(raw_ostream &OS) const
bool extract(DataExtractor Data, uint64_t *OffsetPtr)
DWARFAbbreviationDeclarationSet()
const DWARFAbbreviationDeclaration * getAbbreviationDeclaration(uint32_t AbbrCode) const
std::string getCodeRange() const
bool extract(DataExtractor Data, uint64_t *OffsetPtr)
void extract(DataExtractor Data)
void dump(raw_ostream &OS) const
const DWARFAbbreviationDeclarationSet * getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
This is an optimization pass for GlobalISel generic memory operations.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.