Skip to content

Commit

Permalink
Move function out of line. NFC.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285929 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
espindola committed Nov 3, 2016
1 parent 93f2b8b commit e91b7e8
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions include/llvm/Object/ELF.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,7 @@ class ELFFile {
ErrorOr<const Elf_Shdr *> getSection(uint32_t Index) const;

ErrorOr<const Elf_Sym *> getSymbol(const Elf_Shdr *Sec,
uint32_t Index) const {
auto SymtabOrErr = symbols(Sec);
if (std::error_code EC = SymtabOrErr.getError())
return EC;
Elf_Sym_Range Symbols = *SymtabOrErr;
if (Index >= Symbols.size())
return object_error::invalid_symbol_index;
return &Symbols[Index];
}
uint32_t Index) const;

ErrorOr<StringRef> getSectionName(const Elf_Shdr *Section) const;
ErrorOr<StringRef> getSectionName(const Elf_Shdr *Section,
Expand Down Expand Up @@ -237,6 +229,18 @@ ELFFile<ELFT>::getSection(const Elf_Sym *Sym, const Elf_Shdr *SymTab,
return object::getSection<ELFT>(*SectionsOrErr, Index);
}

template <class ELFT>
ErrorOr<const typename ELFT::Sym *>
ELFFile<ELFT>::getSymbol(const Elf_Shdr *Sec, uint32_t Index) const {
auto SymtabOrErr = symbols(Sec);
if (std::error_code EC = SymtabOrErr.getError())
return EC;
Elf_Sym_Range Symbols = *SymtabOrErr;
if (Index >= Symbols.size())
return object_error::invalid_symbol_index;
return &Symbols[Index];
}

template <class ELFT>
template <typename T>
ErrorOr<ArrayRef<T>>
Expand Down

0 comments on commit e91b7e8

Please sign in to comment.