From: Rafael Espindola Date: Mon, 10 Aug 2015 19:07:56 +0000 (+0000) Subject: toELFSymIter and getSymbol are now the same thing. Merge them. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=42f80af623d408d8f906f1b76342f5ea3f2867c9;p=oota-llvm.git toELFSymIter and getSymbol are now the same thing. Merge them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244482 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Object/ELFObjectFile.h b/include/llvm/Object/ELFObjectFile.h index 633211e056f..538a031c1ad 100644 --- a/include/llvm/Object/ELFObjectFile.h +++ b/include/llvm/Object/ELFObjectFile.h @@ -239,10 +239,6 @@ protected: return *EF.getSection(Rel.d.a); } - const Elf_Sym *toELFSymIter(DataRefImpl Sym) const { - return EF.template getEntry(Sym.d.a, Sym.d.b); - } - DataRefImpl toDRI(const Elf_Shdr *SymTable, unsigned SymbolNum) const { DataRefImpl DRI; if (!SymTable) { @@ -303,7 +299,9 @@ public: const Elf_Rel *getRel(DataRefImpl Rel) const; const Elf_Rela *getRela(DataRefImpl Rela) const; - const Elf_Sym *getSymbol(DataRefImpl Symb) const; + const Elf_Sym *getSymbol(DataRefImpl Sym) const { + return EF.template getEntry(Sym.d.a, Sym.d.b); + } basic_symbol_iterator symbol_begin_impl() const override; basic_symbol_iterator symbol_end_impl() const override; @@ -350,7 +348,7 @@ void ELFObjectFile::moveSymbolNext(DataRefImpl &Sym) const { template ErrorOr ELFObjectFile::getSymbolName(DataRefImpl Sym) const { - const Elf_Sym *ESym = toELFSymIter(Sym); + const Elf_Sym *ESym = getSymbol(Sym); const Elf_Shdr *SymTableSec = *EF.getSection(Sym.d.a); const Elf_Shdr *StringTableSec = *EF.getSection(SymTableSec->sh_link); StringRef SymTable = *EF.getStringTable(StringTableSec); @@ -411,7 +409,7 @@ ELFObjectFile::getSymbolAddress(DataRefImpl Symb) const { template uint32_t ELFObjectFile::getSymbolAlignment(DataRefImpl Symb) const { - const Elf_Sym *Sym = toELFSymIter(Symb); + const Elf_Sym *Sym = getSymbol(Symb); if (Sym->st_shndx == ELF::SHN_COMMON) return Sym->st_value; return 0; @@ -419,22 +417,22 @@ uint32_t ELFObjectFile::getSymbolAlignment(DataRefImpl Symb) const { template uint64_t ELFObjectFile::getSymbolSize(DataRefImpl Sym) const { - return toELFSymIter(Sym)->st_size; + return getSymbol(Sym)->st_size; } template uint64_t ELFObjectFile::getCommonSymbolSizeImpl(DataRefImpl Symb) const { - return toELFSymIter(Symb)->st_size; + return getSymbol(Symb)->st_size; } template uint8_t ELFObjectFile::getSymbolOther(DataRefImpl Symb) const { - return toELFSymIter(Symb)->st_other; + return getSymbol(Symb)->st_other; } template uint8_t ELFObjectFile::getSymbolELFType(DataRefImpl Symb) const { - return toELFSymIter(Symb)->getType(); + return getSymbol(Symb)->getType(); } template @@ -461,7 +459,7 @@ SymbolRef::Type ELFObjectFile::getSymbolType(DataRefImpl Symb) const { template uint32_t ELFObjectFile::getSymbolFlags(DataRefImpl Sym) const { - const Elf_Sym *ESym = toELFSymIter(Sym); + const Elf_Sym *ESym = getSymbol(Sym); uint32_t Result = SymbolRef::SF_None; @@ -711,12 +709,6 @@ ELFObjectFile::getRelocationAddend(DataRefImpl Rel) const { return (int64_t)getRela(Rel)->r_addend; } -template -const typename ELFFile::Elf_Sym * -ELFObjectFile::getSymbol(DataRefImpl Symb) const { - return &*toELFSymIter(Symb); -} - template const typename ELFObjectFile::Elf_Rel * ELFObjectFile::getRel(DataRefImpl Rel) const {