forked from OSchip/llvm-project
[nfc] [lldb] Reduce GetAttributes's depth parameter usage
Clean the code up a bit for D81334. Differential Revision: https://reviews.llvm.org/D81423
This commit is contained in:
parent
0cd4d47cfe
commit
fd31e60b8d
|
@ -104,12 +104,10 @@ bool DWARFBaseDIE::Supports_DW_AT_APPLE_objc_complete_type() const {
|
||||||
return IsValid() && GetDWARF()->Supports_DW_AT_APPLE_objc_complete_type(m_cu);
|
return IsValid() && GetDWARF()->Supports_DW_AT_APPLE_objc_complete_type(m_cu);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t DWARFBaseDIE::GetAttributes(DWARFAttributes &attributes,
|
size_t DWARFBaseDIE::GetAttributes(DWARFAttributes &attributes) const {
|
||||||
uint32_t depth) const {
|
|
||||||
if (IsValid())
|
if (IsValid())
|
||||||
return m_die->GetAttributes(m_cu, attributes, depth);
|
return m_die->GetAttributes(m_cu, attributes);
|
||||||
if (depth == 0)
|
attributes.Clear();
|
||||||
attributes.Clear();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ public:
|
||||||
uint64_t GetAttributeValueAsAddress(const dw_attr_t attr,
|
uint64_t GetAttributeValueAsAddress(const dw_attr_t attr,
|
||||||
uint64_t fail_value) const;
|
uint64_t fail_value) const;
|
||||||
|
|
||||||
size_t GetAttributes(DWARFAttributes &attributes, uint32_t depth = 0) const;
|
size_t GetAttributes(DWARFAttributes &attributes) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DWARFUnit *m_cu;
|
DWARFUnit *m_cu;
|
||||||
|
|
|
@ -436,7 +436,8 @@ size_t DWARFDebugInfoEntry::GetAttributes(
|
||||||
if (form_value.ExtractValue(data, &offset)) {
|
if (form_value.ExtractValue(data, &offset)) {
|
||||||
DWARFDIE spec_die = form_value.Reference();
|
DWARFDIE spec_die = form_value.Reference();
|
||||||
if (spec_die)
|
if (spec_die)
|
||||||
spec_die.GetAttributes(attributes, curr_depth + 1);
|
spec_die.GetDIE()->GetAttributes(spec_die.GetCU(), attributes,
|
||||||
|
curr_depth + 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
llvm::Optional<uint8_t> fixed_skip_size = DWARFFormValue::GetFixedSize(form, cu);
|
llvm::Optional<uint8_t> fixed_skip_size = DWARFFormValue::GetFixedSize(form, cu);
|
||||||
|
|
|
@ -47,10 +47,9 @@ public:
|
||||||
bool Extract(const lldb_private::DWARFDataExtractor &data,
|
bool Extract(const lldb_private::DWARFDataExtractor &data,
|
||||||
const DWARFUnit *cu, lldb::offset_t *offset_ptr);
|
const DWARFUnit *cu, lldb::offset_t *offset_ptr);
|
||||||
|
|
||||||
size_t GetAttributes(const DWARFUnit *cu,
|
size_t GetAttributes(const DWARFUnit *cu, DWARFAttributes &attrs) const {
|
||||||
DWARFAttributes &attrs,
|
return GetAttributes(cu, attrs, 0 /* curr_depth */);
|
||||||
uint32_t curr_depth = 0)
|
}
|
||||||
const; // "curr_depth" for internal use only, don't set this yourself!!!
|
|
||||||
|
|
||||||
dw_offset_t
|
dw_offset_t
|
||||||
GetAttributeValue(const DWARFUnit *cu, const dw_attr_t attr,
|
GetAttributeValue(const DWARFUnit *cu, const dw_attr_t attr,
|
||||||
|
@ -176,6 +175,10 @@ protected:
|
||||||
/// A copy of the DW_TAG value so we don't have to go through the compile
|
/// A copy of the DW_TAG value so we don't have to go through the compile
|
||||||
/// unit abbrev table
|
/// unit abbrev table
|
||||||
dw_tag_t m_tag = llvm::dwarf::DW_TAG_null;
|
dw_tag_t m_tag = llvm::dwarf::DW_TAG_null;
|
||||||
|
|
||||||
|
private:
|
||||||
|
size_t GetAttributes(const DWARFUnit *cu, DWARFAttributes &attrs,
|
||||||
|
uint32_t curr_depth) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGINFOENTRY_H
|
#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGINFOENTRY_H
|
||||||
|
|
Loading…
Reference in New Issue