DWARFDebugAbbrev.h revision dce4a407a24b04eebc6a376f8e62b41aaa7b071f
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
13#include "DWARFAbbreviationDeclaration.h"
14#include <list>
15#include <map>
16#include <vector>
17
18namespace llvm {
19
20class DWARFAbbreviationDeclarationSet {
21  uint32_t Offset;
22  /// Code of the first abbreviation, if all abbreviations in the set have
23  /// consecutive codes. UINT32_MAX otherwise.
24  uint32_t FirstAbbrCode;
25  std::vector<DWARFAbbreviationDeclaration> Decls;
26
27public:
28  DWARFAbbreviationDeclarationSet();
29
30  uint32_t getOffset() const { return Offset; }
31  void dump(raw_ostream &OS) const;
32  bool extract(DataExtractor Data, uint32_t *OffsetPtr);
33
34  const DWARFAbbreviationDeclaration *
35  getAbbreviationDeclaration(uint32_t AbbrCode) const;
36
37private:
38  void clear();
39};
40
41class DWARFDebugAbbrev {
42  typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet>
43    DWARFAbbreviationDeclarationSetMap;
44
45  DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
46  mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
47
48public:
49  DWARFDebugAbbrev();
50
51  const DWARFAbbreviationDeclarationSet *
52  getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const;
53
54  void dump(raw_ostream &OS) const;
55  void extract(DataExtractor Data);
56
57private:
58  void clear();
59};
60
61}
62
63#endif
64