Skip to content

Commit 71d54cd

Browse files
authored
[lldb] Remove (deprecated) Function::GetAddressRange (#132923)
All uses have been replaced by GetAddressRange*s* or GetAddress. Also fix two internal uses of the range member.
1 parent d7cea2b commit 71d54cd

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

lldb/include/lldb/Symbol/Function.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,6 @@ class Function : public UserID, public SymbolContextScope {
445445

446446
Function *CalculateSymbolContextFunction() override;
447447

448-
/// DEPRECATED: Use GetAddressRanges instead.
449-
const AddressRange &GetAddressRange() { return m_range; }
450-
451448
AddressRanges GetAddressRanges() { return m_block.GetRanges(); }
452449

453450
/// Return the address of the function (its entry point). This address is also
@@ -658,11 +655,6 @@ class Function : public UserID, public SymbolContextScope {
658655
/// All lexical blocks contained in this function.
659656
Block m_block;
660657

661-
/// The function address range that covers the widest range needed to contain
662-
/// all blocks. DEPRECATED: do not use this field in new code as the range may
663-
/// include addresses belonging to other functions.
664-
AddressRange m_range;
665-
666658
/// The address (entry point) of the function.
667659
Address m_address;
668660

lldb/source/Symbol/Function.cpp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -254,33 +254,13 @@ Function *IndirectCallEdge::GetCallee(ModuleList &images,
254254

255255
/// @}
256256

257-
AddressRange CollapseRanges(llvm::ArrayRef<AddressRange> ranges) {
258-
if (ranges.empty())
259-
return AddressRange();
260-
if (ranges.size() == 1)
261-
return ranges[0];
262-
263-
Address lowest_addr = ranges[0].GetBaseAddress();
264-
addr_t highest_addr = lowest_addr.GetFileAddress() + ranges[0].GetByteSize();
265-
for (const AddressRange &range : ranges.drop_front()) {
266-
Address range_begin = range.GetBaseAddress();
267-
addr_t range_end = range_begin.GetFileAddress() + range.GetByteSize();
268-
if (range_begin.GetFileAddress() < lowest_addr.GetFileAddress())
269-
lowest_addr = range_begin;
270-
if (range_end > highest_addr)
271-
highest_addr = range_end;
272-
}
273-
return AddressRange(lowest_addr, highest_addr - lowest_addr.GetFileAddress());
274-
}
275-
276257
//
277258
Function::Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
278259
lldb::user_id_t type_uid, const Mangled &mangled, Type *type,
279260
Address address, AddressRanges ranges)
280261
: UserID(func_uid), m_comp_unit(comp_unit), m_type_uid(type_uid),
281262
m_type(type), m_mangled(mangled), m_block(*this, func_uid),
282-
m_range(CollapseRanges(ranges)), m_address(std::move(address)),
283-
m_prologue_byte_size(0) {
263+
m_address(std::move(address)), m_prologue_byte_size(0) {
284264
assert(comp_unit != nullptr);
285265
lldb::addr_t base_file_addr = m_address.GetFileAddress();
286266
for (const AddressRange &range : ranges)
@@ -464,8 +444,7 @@ void Function::Dump(Stream *s, bool show_context) const {
464444
s->EOL();
465445
// Dump the root object
466446
if (m_block.BlockInfoHasBeenParsed())
467-
m_block.Dump(s, m_range.GetBaseAddress().GetFileAddress(), INT_MAX,
468-
show_context);
447+
m_block.Dump(s, m_address.GetFileAddress(), INT_MAX, show_context);
469448
}
470449

471450
void Function::CalculateSymbolContext(SymbolContext *sc) {
@@ -474,8 +453,7 @@ void Function::CalculateSymbolContext(SymbolContext *sc) {
474453
}
475454

476455
ModuleSP Function::CalculateSymbolContextModule() {
477-
SectionSP section_sp(m_range.GetBaseAddress().GetSection());
478-
if (section_sp)
456+
if (SectionSP section_sp = m_address.GetSection())
479457
return section_sp->GetModule();
480458

481459
return this->GetCompileUnit()->GetModule();

0 commit comments

Comments
 (0)