1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:18:12 +00:00

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -20,8 +20,8 @@ namespace ELF {
class DynamicObject : public RefCounted<DynamicObject> {
public:
static NonnullRefPtr<DynamicObject> create(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address);
static const char* name_for_dtag(ElfW(Sword) d_tag);
static NonnullRefPtr<DynamicObject> create(String const& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address);
static char const* name_for_dtag(ElfW(Sword) d_tag);
~DynamicObject();
void dump() const;
@ -52,7 +52,7 @@ public:
class Symbol {
public:
Symbol(const DynamicObject& dynamic, unsigned index, const ElfW(Sym) & sym)
Symbol(DynamicObject const& dynamic, unsigned index, const ElfW(Sym) & sym)
: m_dynamic(dynamic)
, m_sym(sym)
, m_index(index)
@ -60,7 +60,7 @@ public:
}
StringView name() const { return m_dynamic.symbol_string_table_string(m_sym.st_name); }
const char* raw_name() const { return m_dynamic.raw_symbol_string_table_string(m_sym.st_name); }
char const* raw_name() const { return m_dynamic.raw_symbol_string_table_string(m_sym.st_name); }
unsigned section_index() const { return m_sym.st_shndx; }
FlatPtr value() const { return m_sym.st_value; }
size_t size() const { return m_sym.st_size; }
@ -90,17 +90,17 @@ public:
return m_dynamic.base_address().offset(value());
return VirtualAddress { value() };
}
const DynamicObject& object() const { return m_dynamic; }
DynamicObject const& object() const { return m_dynamic; }
private:
const DynamicObject& m_dynamic;
DynamicObject const& m_dynamic;
const ElfW(Sym) & m_sym;
const unsigned m_index;
unsigned const m_index;
};
class Section {
public:
Section(const DynamicObject& dynamic, unsigned section_offset, unsigned section_size_bytes, unsigned entry_size, StringView name)
Section(DynamicObject const& dynamic, unsigned section_offset, unsigned section_size_bytes, unsigned entry_size, StringView name)
: m_dynamic(dynamic)
, m_section_offset(section_offset)
, m_section_size_bytes(section_size_bytes)
@ -126,7 +126,7 @@ public:
protected:
friend class RelocationSection;
friend class HashSection;
const DynamicObject& m_dynamic;
DynamicObject const& m_dynamic;
unsigned m_section_offset;
unsigned m_section_size_bytes;
unsigned m_entry_size;
@ -135,7 +135,7 @@ public:
class RelocationSection : public Section {
public:
explicit RelocationSection(const Section& section, bool addend_used)
explicit RelocationSection(Section const& section, bool addend_used)
: Section(section.m_dynamic, section.m_section_offset, section.m_section_size_bytes, section.m_entry_size, section.m_name)
, m_addend_used(addend_used)
{
@ -150,12 +150,12 @@ public:
void for_each_relocation(F func) const;
private:
const bool m_addend_used;
bool const m_addend_used;
};
class Relocation {
public:
Relocation(const DynamicObject& dynamic, const ElfW(Rela) & rel, unsigned offset_in_section, bool addend_used)
Relocation(DynamicObject const& dynamic, const ElfW(Rela) & rel, unsigned offset_in_section, bool addend_used)
: m_dynamic(dynamic)
, m_rel(rel)
, m_offset_in_section(offset_in_section)
@ -200,10 +200,10 @@ public:
[[nodiscard]] DynamicObject const& dynamic_object() const { return m_dynamic; }
private:
const DynamicObject& m_dynamic;
DynamicObject const& m_dynamic;
const ElfW(Rela) & m_rel;
const unsigned m_offset_in_section;
const bool m_addend_used;
unsigned const m_offset_in_section;
bool const m_addend_used;
};
enum class HashType {
@ -230,13 +230,13 @@ public:
class HashSection : public Section {
public:
HashSection(const Section& section, HashType hash_type)
HashSection(Section const& section, HashType hash_type)
: Section(section.m_dynamic, section.m_section_offset, section.m_section_size_bytes, section.m_entry_size, section.m_name)
, m_hash_type(hash_type)
{
}
Optional<Symbol> lookup_symbol(const HashSymbol& symbol) const
Optional<Symbol> lookup_symbol(HashSymbol const& symbol) const
{
if (m_hash_type == HashType::SYSV)
return lookup_sysv_symbol(symbol.name(), symbol.sysv_hash());
@ -286,7 +286,7 @@ public:
VirtualAddress plt_got_base_address() const { return m_base_address.offset(m_procedure_linkage_table_offset.value()); }
VirtualAddress base_address() const { return m_base_address; }
const String& filename() const { return m_filename; }
String const& filename() const { return m_filename; }
StringView rpath() const { return m_has_rpath ? symbol_string_table_string(m_rpath_index) : StringView {}; }
StringView runpath() const { return m_has_runpath ? symbol_string_table_string(m_runpath_index) : StringView {}; }
@ -326,7 +326,7 @@ public:
};
Optional<SymbolLookupResult> lookup_symbol(StringView name) const;
Optional<SymbolLookupResult> lookup_symbol(const HashSymbol& symbol) const;
Optional<SymbolLookupResult> lookup_symbol(HashSymbol const& symbol) const;
// Will be called from _fixup_plt_entry, as part of the PLT trampoline
VirtualAddress patch_plt_entry(u32 relocation_offset);
@ -336,10 +336,10 @@ public:
void* symbol_for_name(StringView name);
private:
explicit DynamicObject(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address);
explicit DynamicObject(String const& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address);
StringView symbol_string_table_string(ElfW(Word)) const;
const char* raw_symbol_string_table_string(ElfW(Word)) const;
char const* raw_symbol_string_table_string(ElfW(Word)) const;
void parse();
String m_filename;
@ -403,7 +403,7 @@ template<IteratorFunction<DynamicObject::Relocation&> F>
inline void DynamicObject::RelocationSection::for_each_relocation(F func) const
{
for (unsigned i = 0; i < relocation_count(); ++i) {
const auto reloc = relocation(i);
auto const reloc = relocation(i);
if (reloc.type() == 0)
continue;
if (func(reloc) == IterationDecision::Break)