2011-09-13 19:42:23 +00:00
|
|
|
//===-- DWARFAbbreviationDeclaration.h --------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 16:26:38 +00:00
|
|
|
#ifndef LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
|
|
|
|
#define LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
|
2011-09-13 19:42:23 +00:00
|
|
|
|
|
|
|
#include "llvm/ADT/SmallVector.h"
|
|
|
|
#include "llvm/Support/DataExtractor.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class raw_ostream;
|
|
|
|
|
|
|
|
class DWARFAbbreviationDeclaration {
|
|
|
|
uint32_t Code;
|
|
|
|
uint32_t Tag;
|
|
|
|
bool HasChildren;
|
2013-10-31 17:20:14 +00:00
|
|
|
|
|
|
|
struct AttributeSpec {
|
2014-03-14 10:37:36 +00:00
|
|
|
AttributeSpec(uint16_t Attr, uint16_t Form) : Attr(Attr), Form(Form) {}
|
2013-10-31 17:20:14 +00:00
|
|
|
uint16_t Attr;
|
|
|
|
uint16_t Form;
|
|
|
|
};
|
2014-03-13 07:52:54 +00:00
|
|
|
typedef SmallVector<AttributeSpec, 8> AttributeSpecVector;
|
|
|
|
AttributeSpecVector AttributeSpecs;
|
2011-09-13 19:42:23 +00:00
|
|
|
public:
|
2013-10-31 17:20:14 +00:00
|
|
|
DWARFAbbreviationDeclaration();
|
2011-09-13 19:42:23 +00:00
|
|
|
|
|
|
|
uint32_t getCode() const { return Code; }
|
|
|
|
uint32_t getTag() const { return Tag; }
|
|
|
|
bool hasChildren() const { return HasChildren; }
|
2014-03-13 07:52:54 +00:00
|
|
|
|
|
|
|
typedef iterator_range<AttributeSpecVector::const_iterator>
|
|
|
|
attr_iterator_range;
|
|
|
|
|
|
|
|
attr_iterator_range attributes() const {
|
|
|
|
return attr_iterator_range(AttributeSpecs.begin(), AttributeSpecs.end());
|
2011-09-13 19:42:23 +00:00
|
|
|
}
|
2014-03-13 07:52:54 +00:00
|
|
|
|
2011-09-13 19:42:23 +00:00
|
|
|
uint16_t getFormByIndex(uint32_t idx) const {
|
2014-03-13 07:52:54 +00:00
|
|
|
return idx < AttributeSpecs.size() ? AttributeSpecs[idx].Form : 0;
|
2011-09-13 19:42:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t findAttributeIndex(uint16_t attr) const;
|
2013-10-31 17:20:14 +00:00
|
|
|
bool extract(DataExtractor Data, uint32_t* OffsetPtr);
|
2011-09-13 19:42:23 +00:00
|
|
|
void dump(raw_ostream &OS) const;
|
2013-10-31 17:20:14 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void clear();
|
2011-09-13 19:42:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|