DWARFAbbreviationDeclaration.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //===-- DWARFAbbreviationDeclaration.h --------------------------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
  10. #define LLVM_LIB_DEBUGINFO_DWARFABBREVIATIONDECLARATION_H
  11. #include "llvm/ADT/SmallVector.h"
  12. #include "llvm/Support/DataExtractor.h"
  13. namespace llvm {
  14. class raw_ostream;
  15. class DWARFAbbreviationDeclaration {
  16. public:
  17. struct AttributeSpec {
  18. AttributeSpec(uint16_t Attr, uint16_t Form) : Attr(Attr), Form(Form) {}
  19. uint16_t Attr;
  20. uint16_t Form;
  21. };
  22. typedef SmallVector<AttributeSpec, 8> AttributeSpecVector;
  23. DWARFAbbreviationDeclaration();
  24. uint32_t getCode() const { return Code; }
  25. uint32_t getTag() const { return Tag; }
  26. bool hasChildren() const { return HasChildren; }
  27. typedef iterator_range<AttributeSpecVector::const_iterator>
  28. attr_iterator_range;
  29. attr_iterator_range attributes() const {
  30. return attr_iterator_range(AttributeSpecs.begin(), AttributeSpecs.end());
  31. }
  32. uint16_t getFormByIndex(uint32_t idx) const {
  33. return idx < AttributeSpecs.size() ? AttributeSpecs[idx].Form : 0;
  34. }
  35. uint32_t findAttributeIndex(uint16_t attr) const;
  36. bool extract(DataExtractor Data, uint32_t* OffsetPtr);
  37. void dump(raw_ostream &OS) const;
  38. private:
  39. void clear();
  40. uint32_t Code;
  41. uint32_t Tag;
  42. bool HasChildren;
  43. AttributeSpecVector AttributeSpecs;
  44. };
  45. }
  46. #endif