Skip to content

Commit b48e561

Browse files
committed
fixup! fix comments; make function static
1 parent 69b53a2 commit b48e561

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,11 @@ bool DWARFDebugInfoEntry::GetDIENamesAndRanges(
281281
return !ranges.empty();
282282
}
283283

284-
bool DWARFDebugInfoEntry::GetAttributes(
285-
DWARFUnit const *cu, llvm::SmallVector<DWARFDIE> &worklist,
286-
llvm::SmallSet<DWARFDebugInfoEntry const *, 3> &seen,
287-
DWARFAttributes &attributes) const {
284+
/// Helper for the public \ref DWARFDebugInfoEntry::GetAttributes API.
285+
static bool GetAttributes(DWARFUnit const *cu,
286+
llvm::SmallVector<DWARFDIE> &worklist,
287+
llvm::SmallSet<DWARFDebugInfoEntry const *, 3> &seen,
288+
DWARFAttributes &attributes) {
288289
assert(!worklist.empty());
289290
assert(cu);
290291

@@ -348,7 +349,7 @@ bool DWARFDebugInfoEntry::GetAttributes(
348349
return true;
349350
}
350351

351-
DWARFAttributes DWARFDebugInfoEntry::GetAttributes(DWARFUnit *cu,
352+
DWARFAttributes DWARFDebugInfoEntry::GetAttributes(const DWARFUnit *cu,
352353
Recurse recurse) const {
353354
// FIXME: use ElaboratingDIEIterator to follow specifications/abstract origins
354355
// instead of maintaining our own worklist/seen list.
@@ -365,7 +366,7 @@ DWARFAttributes DWARFDebugInfoEntry::GetAttributes(DWARFUnit *cu,
365366
seen.insert(this);
366367

367368
while (!worklist.empty()) {
368-
if (!GetAttributes(cu, worklist, seen, attributes)) {
369+
if (!::GetAttributes(cu, worklist, seen, attributes)) {
369370
attributes.Clear();
370371
break;
371372
}

lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,26 @@ class DWARFDebugInfoEntry {
5353

5454
using Recurse = DWARFBaseDIE::Recurse;
5555

56-
// Get all attribute values for a given DIE, including following any
57-
// specification or abstract origin attributes and including those in the
58-
// results.
59-
//
60-
// When following specifications/abstract origins, the attributes
61-
// on the referring DIE are guaranteed to be visited before the attributes of
62-
// the referenced DIE.
63-
//
64-
// \param[in]
65-
// \param[in]
66-
//
67-
// \returns output may have duplicate entries
68-
DWARFAttributes GetAttributes(DWARFUnit *cu,
56+
/// Get all attribute values for a given DIE, including following any
57+
/// specification or abstract origin attributes and including those in the
58+
/// results.
59+
///
60+
/// When following specifications/abstract origins, the attributes
61+
/// on the referring DIE are guaranteed to be visited before the attributes of
62+
/// the referenced DIE.
63+
///
64+
/// \param[in] cu DWARFUnit that this entry belongs to.
65+
///
66+
/// \param[in] recurse If set to \c Recurse::yes, will include attributes
67+
/// on DIEs referenced via \c DW_AT_specification and \c DW_AT_abstract_origin
68+
/// (including across multiple levels of indirection).
69+
///
70+
/// \returns DWARFAttributes that include all attributes found on this DIE
71+
/// (and possibly referenced DIEs). Attributes may appear multiple times
72+
/// (e.g., if a declaration and definition both specify the same attribute).
73+
/// On failure, the returned DWARFAttributes will be empty.
74+
///
75+
DWARFAttributes GetAttributes(const DWARFUnit *cu,
6976
Recurse recurse = Recurse::yes) const;
7077

7178
dw_offset_t GetAttributeValue(const DWARFUnit *cu, const dw_attr_t attr,
@@ -187,12 +194,6 @@ class DWARFDebugInfoEntry {
187194
/// A copy of the DW_TAG value so we don't have to go through the compile
188195
/// unit abbrev table
189196
dw_tag_t m_tag = llvm::dwarf::DW_TAG_null;
190-
191-
private:
192-
// Helper for the public \ref DWARFDebugInfoEntry::GetAttributes API.
193-
bool GetAttributes(DWARFUnit const *cu, llvm::SmallVector<DWARFDIE> &worklist,
194-
llvm::SmallSet<DWARFDebugInfoEntry const *, 3> &seen,
195-
DWARFAttributes &attributes) const;
196197
};
197198
} // namespace dwarf
198199
} // namespace lldb_private::plugin

lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,6 @@ TEST_P(GetAttributesTestFixture, TestGetAttributes_Cycle) {
584584

585585
auto attrs = func.GetAttributes(DWARFDebugInfoEntry::Recurse::yes);
586586
EXPECT_EQ(attrs.Size(), 3U);
587-
588-
// TODO: check that we do form a cycle with the DIEs
589587
}
590588

591589
TEST_P(GetAttributesTestFixture,

0 commit comments

Comments
 (0)