1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:27:35 +00:00

ELF: Run clang-format on everything.

This commit is contained in:
Andreas Kling 2019-06-07 17:12:30 +02:00
parent e42c3b4fd7
commit 9145917bf0
5 changed files with 551 additions and 547 deletions

View file

@ -1,9 +1,9 @@
#pragma once
#include <AK/OwnPtr.h>
#include <AK/HashMap.h>
#include <AK/AKString.h>
#include <AK/ELF/exec_elf.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
class ELFImage {
public:
@ -27,7 +27,7 @@ public:
{
}
~Symbol() { }
~Symbol() {}
const char* name() const { return m_image.table_string(m_sym.st_name); }
unsigned section_index() const { return m_sym.st_shndx; }
@ -51,7 +51,7 @@ public:
, m_program_header_index(program_header_index)
{
}
~ProgramHeader() { }
~ProgramHeader() {}
unsigned index() const { return m_program_header_index; }
dword type() const { return m_program_header.p_type; }
@ -65,6 +65,7 @@ public:
bool is_writable() const { return flags() & PF_W; }
bool is_executable() const { return flags() & PF_X; }
const char* raw_data() const { return m_image.raw_data(m_program_header.p_offset); }
private:
const ELFImage& m_image;
const Elf32_Phdr& m_program_header;
@ -79,7 +80,7 @@ public:
, m_section_index(sectionIndex)
{
}
~Section() { }
~Section() {}
const char* name() const { return m_image.section_header_table_string(m_section_header.sh_name); }
unsigned type() const { return m_section_header.sh_type; }
@ -109,10 +110,14 @@ public:
const Section section(unsigned) const;
const ProgramHeader program_header(unsigned const) const;
template<typename F> void for_each_section(F) const;
template<typename F> void for_each_section_of_type(unsigned, F) const;
template<typename F> void for_each_symbol(F) const;
template<typename F> void for_each_program_header(F) const;
template<typename F>
void for_each_section(F) const;
template<typename F>
void for_each_section_of_type(unsigned, F) const;
template<typename F>
void for_each_symbol(F) const;
template<typename F>
void for_each_program_header(F) const;
bool is_executable() const { return header().e_type == ET_EXEC; }
bool is_relocatable() const { return header().e_type == ET_REL; }
@ -158,7 +163,7 @@ template<typename F>
inline void ELFImage::for_each_symbol(F func) const
{
for (unsigned i = 0; i < symbol_count(); ++i) {
if (func(symbol(i)) == IterationDecision::Abort)
if (func(symbol(i)) == IterationDecision::Break)
break;
}
}