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_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
11 #define LLVM_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
13 #include "DWARFAttribute.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/Support/DataExtractor.h"
21 class DWARFAbbreviationDeclaration {
25 SmallVector<DWARFAttribute, 8> Attributes;
27 enum { InvalidCode = 0 };
28 DWARFAbbreviationDeclaration()
29 : Code(InvalidCode), Tag(0), HasChildren(0) {}
31 uint32_t getCode() const { return Code; }
32 uint32_t getTag() const { return Tag; }
33 bool hasChildren() const { return HasChildren; }
34 uint32_t getNumAttributes() const { return Attributes.size(); }
35 uint16_t getAttrByIndex(uint32_t idx) const {
36 return Attributes.size() > idx ? Attributes[idx].getAttribute() : 0;
38 uint16_t getFormByIndex(uint32_t idx) const {
39 return Attributes.size() > idx ? Attributes[idx].getForm() : 0;
42 uint32_t findAttributeIndex(uint16_t attr) const;
43 bool extract(DataExtractor data, uint32_t* offset_ptr);
44 bool extract(DataExtractor data, uint32_t* offset_ptr, uint32_t code);
45 bool isValid() const { return Code != 0 && Tag != 0; }
46 void dump(raw_ostream &OS) const;
47 const SmallVectorImpl<DWARFAttribute> &getAttributes() const {