LibELF: Remove sketchy use of "undefined" ELF::Image::Section

We were using ELF::Image::section(0) to indicate the "undefined"
section, when what we really wanted was just Optional<Section>.

So let's use Optional instead. :^)
This commit is contained in:
Andreas Kling 2021-05-15 00:13:44 +02:00
commit 16221305ad
Notes: sideshowbarker 2024-07-18 18:08:15 +09:00
6 changed files with 18 additions and 19 deletions

View file

@ -24,9 +24,9 @@ DwarfInfo::DwarfInfo(const ELF::Image& elf)
ReadonlyBytes DwarfInfo::section_data(const String& section_name) const
{
auto section = m_elf.lookup_section(section_name);
if (section.is_undefined())
if (!section.has_value())
return {};
return section.bytes();
return section->bytes();
}
void DwarfInfo::populate_compilation_units()