@@ -254,33 +254,13 @@ Function *IndirectCallEdge::GetCallee(ModuleList &images,
254
254
255
255
// / @}
256
256
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
-
276
257
//
277
258
Function::Function (CompileUnit *comp_unit, lldb::user_id_t func_uid,
278
259
lldb::user_id_t type_uid, const Mangled &mangled, Type *type,
279
260
Address address, AddressRanges ranges)
280
261
: UserID(func_uid), m_comp_unit(comp_unit), m_type_uid(type_uid),
281
262
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 ) {
284
264
assert (comp_unit != nullptr );
285
265
lldb::addr_t base_file_addr = m_address.GetFileAddress ();
286
266
for (const AddressRange &range : ranges)
@@ -464,8 +444,7 @@ void Function::Dump(Stream *s, bool show_context) const {
464
444
s->EOL ();
465
445
// Dump the root object
466
446
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);
469
448
}
470
449
471
450
void Function::CalculateSymbolContext (SymbolContext *sc) {
@@ -474,8 +453,7 @@ void Function::CalculateSymbolContext(SymbolContext *sc) {
474
453
}
475
454
476
455
ModuleSP Function::CalculateSymbolContextModule () {
477
- SectionSP section_sp (m_range.GetBaseAddress ().GetSection ());
478
- if (section_sp)
456
+ if (SectionSP section_sp = m_address.GetSection ())
479
457
return section_sp->GetModule ();
480
458
481
459
return this ->GetCompileUnit ()->GetModule ();
0 commit comments