LLVM  8.0.1
DWARFDebugAbbrev.h
Go to the documentation of this file.
1 //===- DWARFDebugAbbrev.h ---------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_DEBUGINFO_DWARFDEBUGABBREV_H
11 #define LLVM_DEBUGINFO_DWARFDEBUGABBREV_H
12 
15 #include <cstdint>
16 #include <map>
17 #include <vector>
18 
19 namespace llvm {
20 
21 class raw_ostream;
22 
24  uint32_t Offset;
25  /// Code of the first abbreviation, if all abbreviations in the set have
26  /// consecutive codes. UINT32_MAX otherwise.
27  uint32_t FirstAbbrCode;
28  std::vector<DWARFAbbreviationDeclaration> Decls;
29 
30  using const_iterator =
31  std::vector<DWARFAbbreviationDeclaration>::const_iterator;
32 
33 public:
35 
36  uint32_t getOffset() const { return Offset; }
37  void dump(raw_ostream &OS) const;
38  bool extract(DataExtractor Data, uint32_t *OffsetPtr);
39 
41  getAbbreviationDeclaration(uint32_t AbbrCode) const;
42 
43  const_iterator begin() const {
44  return Decls.begin();
45  }
46 
47  const_iterator end() const {
48  return Decls.end();
49  }
50 
51 private:
52  void clear();
53 };
54 
56  using DWARFAbbreviationDeclarationSetMap =
57  std::map<uint64_t, DWARFAbbreviationDeclarationSet>;
58 
59  mutable DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
60  mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
62 
63 public:
65 
67  getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const;
68 
69  void dump(raw_ostream &OS) const;
70  void parse() const;
71  void extract(DataExtractor Data);
72 
73  DWARFAbbreviationDeclarationSetMap::const_iterator begin() const {
74  parse();
75  return AbbrDeclSets.begin();
76  }
77 
78  DWARFAbbreviationDeclarationSetMap::const_iterator end() const {
79  return AbbrDeclSets.end();
80  }
81 
82 private:
83  void clear();
84 };
85 
86 } // end namespace llvm
87 
88 #endif // LLVM_DEBUGINFO_DWARFDEBUGABBREV_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
bool extract(DataExtractor Data, uint32_t *OffsetPtr)
void dump(raw_ostream &OS) const
const DWARFAbbreviationDeclaration * getAbbreviationDeclaration(uint32_t AbbrCode) const
llvm::Expected< Value > parse(llvm::StringRef JSON)
Parses the provided JSON source, or returns a ParseError.
Definition: JSON.cpp:511
DWARFAbbreviationDeclarationSetMap::const_iterator begin() const
DWARFAbbreviationDeclarationSetMap::const_iterator end() const
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46