Skip to content

Commit d2fd8d4

Browse files
committed
Switch from shared_ptr to just a local
1 parent 98581d9 commit d2fd8d4

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

lldb/include/lldb/Core/Section.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ class SectionList {
104104
// Function that merges two different sections into a new output list. All
105105
// unique sections will be checked for conflict and resolved using the
106106
// supplied merging callback.
107-
static std::shared_ptr<SectionList> Merge(SectionList &lhs, SectionList &rhs,
108-
MergeCallback filter);
107+
static SectionList Merge(SectionList &lhs, SectionList &rhs,
108+
MergeCallback filter);
109109

110110
protected:
111111
collection m_sections;

lldb/source/Core/Section.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,18 +683,18 @@ uint64_t SectionList::GetDebugInfoSize() const {
683683
return debug_info_size;
684684
}
685685

686-
std::shared_ptr<SectionList>
687-
SectionList::Merge(SectionList &lhs, SectionList &rhs, MergeCallback filter) {
688-
std::shared_ptr<SectionList> output_sp = std::make_shared<SectionList>();
686+
SectionList SectionList::Merge(SectionList &lhs, SectionList &rhs,
687+
MergeCallback filter) {
688+
SectionList output_list;
689689

690690
// Iterate through all the sections in lhs and see if we have matches in
691691
// the rhs list.
692692
for (const auto &lhs_section : lhs) {
693693
auto rhs_section = rhs.FindSectionByName(lhs_section->GetName());
694694
if (rhs_section)
695-
output_sp->AddSection(filter(lhs_section, rhs_section));
695+
output_list.AddSection(filter(lhs_section, rhs_section));
696696
else
697-
output_sp->AddSection(lhs_section);
697+
output_list.AddSection(lhs_section);
698698
}
699699

700700
// Now that we've visited all possible duplicates, we can iterate over
@@ -704,10 +704,10 @@ SectionList::Merge(SectionList &lhs, SectionList &rhs, MergeCallback filter) {
704704
// Because we already visited everything overlapping between rhs
705705
// and lhs, any section not in lhs is unique and can be output.
706706
if (!lhs_section)
707-
output_sp->AddSection(rhs_section);
707+
output_list.AddSection(rhs_section);
708708
}
709709

710-
return output_sp;
710+
return output_list;
711711
}
712712

713713
namespace llvm {

lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,9 +1992,8 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
19921992

19931993
// Merge the two adding any new sections, and overwriting any existing
19941994
// sections that are SHT_NOBITS
1995-
std::shared_ptr<SectionList> merged_section_list =
1995+
unified_section_list =
19961996
SectionList::Merge(unified_section_list, *m_sections_up, MergeSections);
1997-
unified_section_list = *merged_section_list;
19981997

19991998
// If there's a .gnu_debugdata section, we'll try to read the .symtab that's
20001999
// embedded in there and replace the one in the original object file (if any).

0 commit comments

Comments
 (0)