LLDB mainline
DWARFAttribute.h
Go to the documentation of this file.
1//===-- DWARFAttribute.h ----------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
11
12#include "DWARFDefines.h"
13#include "DWARFFormValue.h"
14#include "llvm/ADT/SmallVector.h"
15#include <vector>
16
17class DWARFUnit;
18
20public:
23 : m_attr(attr), m_form(form), m_value(value) {}
24
25 dw_attr_t get_attr() const { return m_attr; }
26 dw_form_t get_form() const { return m_form; }
28 void get(dw_attr_t &attr, dw_form_t &form,
29 DWARFFormValue::ValueType &val) const {
30 attr = m_attr;
31 form = m_form;
32 val = m_value;
33 }
34 typedef std::vector<DWARFAttribute> collection;
35 typedef collection::iterator iterator;
36 typedef collection::const_iterator const_iterator;
37
38protected:
42};
43
45public:
48
49 void Append(const DWARFFormValue &form_value, dw_offset_t attr_die_offset,
50 dw_attr_t attr);
51 DWARFUnit *CompileUnitAtIndex(uint32_t i) const { return m_infos[i].cu; }
53 return m_infos[i].die_offset;
54 }
56 return m_infos[i].attr.get_attr();
57 }
58 dw_attr_t FormAtIndex(uint32_t i) const { return m_infos[i].attr.get_form(); }
60 return m_infos[i].attr.get_value();
61 }
62 bool ExtractFormValueAtIndex(uint32_t i, DWARFFormValue &form_value) const;
66 void Clear() { m_infos.clear(); }
67 size_t Size() const { return m_infos.size(); }
68
69protected:
71 DWARFUnit *cu; // Keep the compile unit with each attribute in
72 // case we have DW_FORM_ref_addr values
75 };
76 typedef llvm::SmallVector<AttributeValue, 8> collection;
78};
79
80#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
collection::iterator iterator
dw_form_t m_form
void get(dw_attr_t &attr, dw_form_t &form, DWARFFormValue::ValueType &val) const
DWARFAttribute(dw_attr_t attr, dw_form_t form, DWARFFormValue::ValueType value)
DWARFFormValue::ValueType m_value
dw_attr_t get_attr() const
dw_form_t get_form() const
DWARFFormValue::ValueType get_value() const
dw_attr_t m_attr
std::vector< DWARFAttribute > collection
collection::const_iterator const_iterator
llvm::SmallVector< AttributeValue, 8 > collection
dw_attr_t AttributeAtIndex(uint32_t i) const
DWARFDIE FormValueAsReferenceAtIndex(uint32_t i) const
DWARFUnit * CompileUnitAtIndex(uint32_t i) const
dw_offset_t DIEOffsetAtIndex(uint32_t i) const
DWARFDIE FormValueAsReference(dw_attr_t attr) const
bool ExtractFormValueAtIndex(uint32_t i, DWARFFormValue &form_value) const
uint32_t FindAttributeIndex(dw_attr_t attr) const
dw_attr_t FormAtIndex(uint32_t i) const
collection m_infos
DWARFFormValue::ValueType ValueAtIndex(uint32_t i) const
size_t Size() const
void Append(const DWARFFormValue &form_value, dw_offset_t attr_die_offset, dw_attr_t attr)
uint64_t dw_offset_t
Definition: dwarf.h:33