DWARFAbbreviationDeclaration.h revision 263508
1226584Sdim//===-- DWARFAbbreviationDeclaration.h --------------------------*- C++ -*-===// 2226584Sdim// 3226584Sdim// The LLVM Compiler Infrastructure 4226584Sdim// 5226584Sdim// This file is distributed under the University of Illinois Open Source 6226584Sdim// License. See LICENSE.TXT for details. 7226584Sdim// 8226584Sdim//===----------------------------------------------------------------------===// 9226584Sdim 10226584Sdim#ifndef LLVM_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H 11226584Sdim#define LLVM_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H 12226584Sdim 13226584Sdim#include "llvm/ADT/SmallVector.h" 14226584Sdim#include "llvm/Support/DataExtractor.h" 15226584Sdim 16226584Sdimnamespace llvm { 17226584Sdim 18226584Sdimclass raw_ostream; 19226584Sdim 20226584Sdimclass DWARFAbbreviationDeclaration { 21226584Sdim uint32_t Code; 22226584Sdim uint32_t Tag; 23226584Sdim bool HasChildren; 24263508Sdim 25263508Sdim struct AttributeSpec { 26263508Sdim AttributeSpec(uint16_t Attr, uint16_t Form) : Attr(Attr), Form(Form) {} 27263508Sdim uint16_t Attr; 28263508Sdim uint16_t Form; 29263508Sdim }; 30263508Sdim SmallVector<AttributeSpec, 8> Attributes; 31226584Sdimpublic: 32263508Sdim DWARFAbbreviationDeclaration(); 33226584Sdim 34226584Sdim uint32_t getCode() const { return Code; } 35226584Sdim uint32_t getTag() const { return Tag; } 36226584Sdim bool hasChildren() const { return HasChildren; } 37263508Sdim uint32_t getNumAttributes() const { return Attributes.size(); } 38226584Sdim uint16_t getAttrByIndex(uint32_t idx) const { 39263508Sdim return idx < Attributes.size() ? Attributes[idx].Attr : 0; 40226584Sdim } 41226584Sdim uint16_t getFormByIndex(uint32_t idx) const { 42263508Sdim return idx < Attributes.size() ? Attributes[idx].Form : 0; 43226584Sdim } 44226584Sdim 45226584Sdim uint32_t findAttributeIndex(uint16_t attr) const; 46263508Sdim bool extract(DataExtractor Data, uint32_t* OffsetPtr); 47226584Sdim void dump(raw_ostream &OS) const; 48263508Sdim 49263508Sdimprivate: 50263508Sdim void clear(); 51226584Sdim}; 52226584Sdim 53226584Sdim} 54226584Sdim 55226584Sdim#endif 56