[Lldb-commits] [lldb] fd31e60 - [nfc] [lldb] Reduce GetAttributes's depth parameter usage
Jan Kratochvil via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 9 04:41:16 PDT 2020
Author: Jan Kratochvil
Date: 2020-06-09T13:41:06+02:00
New Revision: fd31e60b8ded16754f484b51c2e5f8da05ad8331
URL: https://github.com/llvm/llvm-project/commit/fd31e60b8ded16754f484b51c2e5f8da05ad8331
DIFF: https://github.com/llvm/llvm-project/commit/fd31e60b8ded16754f484b51c2e5f8da05ad8331.diff
LOG: [nfc] [lldb] Reduce GetAttributes's depth parameter usage
Clean the code up a bit for D81334.
Differential Revision: https://reviews.llvm.org/D81423
Added:
Modified:
lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
Removed:
################################################################################
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
index 8bd21c65d28b..c330effc080b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
@@ -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);
}
-size_t DWARFBaseDIE::GetAttributes(DWARFAttributes &attributes,
- uint32_t depth) const {
+size_t DWARFBaseDIE::GetAttributes(DWARFAttributes &attributes) const {
if (IsValid())
- return m_die->GetAttributes(m_cu, attributes, depth);
- if (depth == 0)
- attributes.Clear();
+ return m_die->GetAttributes(m_cu, attributes);
+ attributes.Clear();
return 0;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
index 48320c8b06de..0bad53ff4329 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
@@ -110,7 +110,7 @@ class DWARFBaseDIE {
uint64_t GetAttributeValueAsAddress(const dw_attr_t attr,
uint64_t fail_value) const;
- size_t GetAttributes(DWARFAttributes &attributes, uint32_t depth = 0) const;
+ size_t GetAttributes(DWARFAttributes &attributes) const;
protected:
DWARFUnit *m_cu;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 7b96c15bf3f9..a133ce126027 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -436,7 +436,8 @@ size_t DWARFDebugInfoEntry::GetAttributes(
if (form_value.ExtractValue(data, &offset)) {
DWARFDIE spec_die = form_value.Reference();
if (spec_die)
- spec_die.GetAttributes(attributes, curr_depth + 1);
+ spec_die.GetDIE()->GetAttributes(spec_die.GetCU(), attributes,
+ curr_depth + 1);
}
} else {
llvm::Optional<uint8_t> fixed_skip_size = DWARFFormValue::GetFixedSize(form, cu);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
index 3fb9c9135e85..7bcff312b1c5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -47,10 +47,9 @@ class DWARFDebugInfoEntry {
bool Extract(const lldb_private::DWARFDataExtractor &data,
const DWARFUnit *cu, lldb::offset_t *offset_ptr);
- size_t GetAttributes(const DWARFUnit *cu,
- DWARFAttributes &attrs,
- uint32_t curr_depth = 0)
- const; // "curr_depth" for internal use only, don't set this yourself!!!
+ size_t GetAttributes(const DWARFUnit *cu, DWARFAttributes &attrs) const {
+ return GetAttributes(cu, attrs, 0 /* curr_depth */);
+ }
dw_offset_t
GetAttributeValue(const DWARFUnit *cu, const dw_attr_t attr,
@@ -176,6 +175,10 @@ class DWARFDebugInfoEntry {
/// A copy of the DW_TAG value so we don't have to go through the compile
/// unit abbrev table
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
More information about the lldb-commits
mailing list