Inline function into only use.

llvm-svn: 285928
This commit is contained in:
Rafael Espindola 2016-11-03 16:10:39 +00:00
parent a25f90d698
commit 1b814753ec
1 changed files with 6 additions and 15 deletions

View File

@ -147,9 +147,6 @@ public:
}
ErrorOr<StringRef> getSectionStringTable(Elf_Shdr_Range Sections) const;
ErrorOr<uint32_t>
getExtendedSymbolTableIndex(const Elf_Sym *Sym, const Elf_Shdr *SymTab,
ArrayRef<Elf_Word> ShndxTable) const;
const Elf_Ehdr *getHeader() const { return Header; }
ErrorOr<uint32_t> getSectionIndex(const Elf_Sym *Sym, const Elf_Shdr *SymTab,
ArrayRef<Elf_Word> ShndxTable) const;
@ -203,24 +200,18 @@ getExtendedSymbolTableIndex(const typename ELFT::Sym *Sym,
return ShndxTable[Index];
}
template <class ELFT>
ErrorOr<uint32_t> ELFFile<ELFT>::getExtendedSymbolTableIndex(
const Elf_Sym *Sym, const Elf_Shdr *SymTab,
ArrayRef<Elf_Word> ShndxTable) const {
auto SymsOrErr = symbols(SymTab);
if (std::error_code EC = SymsOrErr.getError())
return EC;
return object::getExtendedSymbolTableIndex<ELFT>(Sym, SymsOrErr->begin(),
ShndxTable);
}
template <class ELFT>
ErrorOr<uint32_t>
ELFFile<ELFT>::getSectionIndex(const Elf_Sym *Sym, const Elf_Shdr *SymTab,
ArrayRef<Elf_Word> ShndxTable) const {
auto SymsOrErr = symbols(SymTab);
if (std::error_code EC = SymsOrErr.getError())
return EC;
uint32_t Index = Sym->st_shndx;
if (Index == ELF::SHN_XINDEX) {
auto ErrorOrIndex = getExtendedSymbolTableIndex(Sym, SymTab, ShndxTable);
auto ErrorOrIndex = object::getExtendedSymbolTableIndex<ELFT>(
Sym, SymsOrErr->begin(), ShndxTable);
if (std::error_code EC = ErrorOrIndex.getError())
return EC;
return *ErrorOrIndex;