Home | History | Annotate | Download | only in DWARF
      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_LIB_DEBUGINFO_DWARFDEBUGABBREV_H
     11 #define LLVM_LIB_DEBUGINFO_DWARFDEBUGABBREV_H
     12 
     13 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
     14 #include <list>
     15 #include <map>
     16 #include <vector>
     17 
     18 namespace llvm {
     19 
     20 class 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 
     27 public:
     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 
     37 private:
     38   void clear();
     39 };
     40 
     41 class DWARFDebugAbbrev {
     42   typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet>
     43     DWARFAbbreviationDeclarationSetMap;
     44 
     45   DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
     46   mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
     47 
     48 public:
     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 
     57 private:
     58   void clear();
     59 };
     60 
     61 }
     62 
     63 #endif
     64