1 //===- DWARFDebugAbbrev.h ---------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_DWARFDEBUGABBREV_H
10 #define LLVM_DEBUGINFO_DWARFDEBUGABBREV_H
12 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
13 #include "llvm/Support/DataExtractor.h"
22 class DWARFAbbreviationDeclarationSet {
24 /// Code of the first abbreviation, if all abbreviations in the set have
25 /// consecutive codes. UINT32_MAX otherwise.
26 uint32_t FirstAbbrCode;
27 std::vector<DWARFAbbreviationDeclaration> Decls;
29 using const_iterator =
30 std::vector<DWARFAbbreviationDeclaration>::const_iterator;
33 DWARFAbbreviationDeclarationSet();
35 uint32_t getOffset() const { return Offset; }
36 void dump(raw_ostream &OS) const;
37 bool extract(DataExtractor Data, uint32_t *OffsetPtr);
39 const DWARFAbbreviationDeclaration *
40 getAbbreviationDeclaration(uint32_t AbbrCode) const;
42 const_iterator begin() const {
46 const_iterator end() const {
54 class DWARFDebugAbbrev {
55 using DWARFAbbreviationDeclarationSetMap =
56 std::map<uint64_t, DWARFAbbreviationDeclarationSet>;
58 mutable DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
59 mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
60 mutable Optional<DataExtractor> Data;
65 const DWARFAbbreviationDeclarationSet *
66 getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const;
68 void dump(raw_ostream &OS) const;
70 void extract(DataExtractor Data);
72 DWARFAbbreviationDeclarationSetMap::const_iterator begin() const {
74 return AbbrDeclSets.begin();
77 DWARFAbbreviationDeclarationSetMap::const_iterator end() const {
78 return AbbrDeclSets.end();
85 } // end namespace llvm
87 #endif // LLVM_DEBUGINFO_DWARFDEBUGABBREV_H