[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.
This commit is contained in:
Pavel Labath 2025-03-27 11:27:56 +01:00 committed by GitHub
parent d7cea2b187
commit 71d54cd4f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 33 deletions

View File

@ -445,9 +445,6 @@ public:
Function *CalculateSymbolContextFunction() override;
/// DEPRECATED: Use GetAddressRanges instead.
const AddressRange &GetAddressRange() { return m_range; }
AddressRanges GetAddressRanges() { return m_block.GetRanges(); }
/// Return the address of the function (its entry point). This address is also
@ -658,11 +655,6 @@ protected:
/// All lexical blocks contained in this function.
Block m_block;
/// The function address range that covers the widest range needed to contain
/// all blocks. DEPRECATED: do not use this field in new code as the range may
/// include addresses belonging to other functions.
AddressRange m_range;
/// The address (entry point) of the function.
Address m_address;

View File

@ -254,33 +254,13 @@ Function *IndirectCallEdge::GetCallee(ModuleList &images,
/// @}
AddressRange CollapseRanges(llvm::ArrayRef<AddressRange> ranges) {
if (ranges.empty())
return AddressRange();
if (ranges.size() == 1)
return ranges[0];
Address lowest_addr = ranges[0].GetBaseAddress();
addr_t highest_addr = lowest_addr.GetFileAddress() + ranges[0].GetByteSize();
for (const AddressRange &range : ranges.drop_front()) {
Address range_begin = range.GetBaseAddress();
addr_t range_end = range_begin.GetFileAddress() + range.GetByteSize();
if (range_begin.GetFileAddress() < lowest_addr.GetFileAddress())
lowest_addr = range_begin;
if (range_end > highest_addr)
highest_addr = range_end;
}
return AddressRange(lowest_addr, highest_addr - lowest_addr.GetFileAddress());
}
//
Function::Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t type_uid, const Mangled &mangled, Type *type,
Address address, AddressRanges ranges)
: UserID(func_uid), m_comp_unit(comp_unit), m_type_uid(type_uid),
m_type(type), m_mangled(mangled), m_block(*this, func_uid),
m_range(CollapseRanges(ranges)), m_address(std::move(address)),
m_prologue_byte_size(0) {
m_address(std::move(address)), m_prologue_byte_size(0) {
assert(comp_unit != nullptr);
lldb::addr_t base_file_addr = m_address.GetFileAddress();
for (const AddressRange &range : ranges)
@ -464,8 +444,7 @@ void Function::Dump(Stream *s, bool show_context) const {
s->EOL();
// Dump the root object
if (m_block.BlockInfoHasBeenParsed())
m_block.Dump(s, m_range.GetBaseAddress().GetFileAddress(), INT_MAX,
show_context);
m_block.Dump(s, m_address.GetFileAddress(), INT_MAX, show_context);
}
void Function::CalculateSymbolContext(SymbolContext *sc) {
@ -474,8 +453,7 @@ void Function::CalculateSymbolContext(SymbolContext *sc) {
}
ModuleSP Function::CalculateSymbolContextModule() {
SectionSP section_sp(m_range.GetBaseAddress().GetSection());
if (section_sp)
if (SectionSP section_sp = m_address.GetSection())
return section_sp->GetModule();
return this->GetCompileUnit()->GetModule();