LLVM API Documentation
00001 //===-- DWARFAbbreviationDeclaration.h --------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H 00011 #define LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H 00012 00013 #include "llvm/ADT/SmallVector.h" 00014 #include "llvm/Support/DataExtractor.h" 00015 00016 namespace llvm { 00017 00018 class raw_ostream; 00019 00020 class DWARFAbbreviationDeclaration { 00021 uint32_t Code; 00022 uint32_t Tag; 00023 bool HasChildren; 00024 00025 struct AttributeSpec { 00026 AttributeSpec(uint16_t Attr, uint16_t Form) : Attr(Attr), Form(Form) {} 00027 uint16_t Attr; 00028 uint16_t Form; 00029 }; 00030 typedef SmallVector<AttributeSpec, 8> AttributeSpecVector; 00031 AttributeSpecVector AttributeSpecs; 00032 public: 00033 DWARFAbbreviationDeclaration(); 00034 00035 uint32_t getCode() const { return Code; } 00036 uint32_t getTag() const { return Tag; } 00037 bool hasChildren() const { return HasChildren; } 00038 00039 typedef iterator_range<AttributeSpecVector::const_iterator> 00040 attr_iterator_range; 00041 00042 attr_iterator_range attributes() const { 00043 return attr_iterator_range(AttributeSpecs.begin(), AttributeSpecs.end()); 00044 } 00045 00046 uint16_t getFormByIndex(uint32_t idx) const { 00047 return idx < AttributeSpecs.size() ? AttributeSpecs[idx].Form : 0; 00048 } 00049 00050 uint32_t findAttributeIndex(uint16_t attr) const; 00051 bool extract(DataExtractor Data, uint32_t* OffsetPtr); 00052 void dump(raw_ostream &OS) const; 00053 00054 private: 00055 void clear(); 00056 }; 00057 00058 } 00059 00060 #endif