1 //===-- DWARFAbbreviationDeclaration.h --------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
11 #define LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/Support/DataExtractor.h"
20 class DWARFAbbreviationDeclaration {
22 struct AttributeSpec {
23 AttributeSpec(uint16_t Attr, uint16_t Form) : Attr(Attr), Form(Form) {}
27 typedef SmallVector<AttributeSpec, 8> AttributeSpecVector;
29 DWARFAbbreviationDeclaration();
31 uint32_t getCode() const { return Code; }
32 uint32_t getTag() const { return Tag; }
33 bool hasChildren() const { return HasChildren; }
35 typedef iterator_range<AttributeSpecVector::const_iterator>
38 attr_iterator_range attributes() const {
39 return attr_iterator_range(AttributeSpecs.begin(), AttributeSpecs.end());
42 uint16_t getFormByIndex(uint32_t idx) const {
43 return idx < AttributeSpecs.size() ? AttributeSpecs[idx].Form : 0;
46 uint32_t findAttributeIndex(uint16_t attr) const;
47 bool extract(DataExtractor Data, uint32_t* OffsetPtr);
48 void dump(raw_ostream &OS) const;
57 AttributeSpecVector AttributeSpecs;