[llvm] r244482 - toELFSymIter and getSymbol are now the same thing. Merge them.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 12:07:57 PDT 2015
Author: rafael
Date: Mon Aug 10 14:07:56 2015
New Revision: 244482
URL: http://llvm.org/viewvc/llvm-project?rev=244482&view=rev
Log:
toELFSymIter and getSymbol are now the same thing. Merge them.
Modified:
llvm/trunk/include/llvm/Object/ELFObjectFile.h
Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=244482&r1=244481&r2=244482&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Mon Aug 10 14:07:56 2015
@@ -239,10 +239,6 @@ protected:
return *EF.getSection(Rel.d.a);
}
- const Elf_Sym *toELFSymIter(DataRefImpl Sym) const {
- return EF.template getEntry<Elf_Sym>(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<Elf_Sym>(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<ELFT>::moveSymbolNext
template <class ELFT>
ErrorOr<StringRef> ELFObjectFile<ELFT>::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<ELFT>::getSymbolAddress(Da
template <class ELFT>
uint32_t ELFObjectFile<ELFT>::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<ELFT>::getSymbolA
template <class ELFT>
uint64_t ELFObjectFile<ELFT>::getSymbolSize(DataRefImpl Sym) const {
- return toELFSymIter(Sym)->st_size;
+ return getSymbol(Sym)->st_size;
}
template <class ELFT>
uint64_t ELFObjectFile<ELFT>::getCommonSymbolSizeImpl(DataRefImpl Symb) const {
- return toELFSymIter(Symb)->st_size;
+ return getSymbol(Symb)->st_size;
}
template <class ELFT>
uint8_t ELFObjectFile<ELFT>::getSymbolOther(DataRefImpl Symb) const {
- return toELFSymIter(Symb)->st_other;
+ return getSymbol(Symb)->st_other;
}
template <class ELFT>
uint8_t ELFObjectFile<ELFT>::getSymbolELFType(DataRefImpl Symb) const {
- return toELFSymIter(Symb)->getType();
+ return getSymbol(Symb)->getType();
}
template <class ELFT>
@@ -461,7 +459,7 @@ SymbolRef::Type ELFObjectFile<ELFT>::get
template <class ELFT>
uint32_t ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Sym) const {
- const Elf_Sym *ESym = toELFSymIter(Sym);
+ const Elf_Sym *ESym = getSymbol(Sym);
uint32_t Result = SymbolRef::SF_None;
@@ -712,12 +710,6 @@ ELFObjectFile<ELFT>::getRelocationAddend
}
template <class ELFT>
-const typename ELFFile<ELFT>::Elf_Sym *
-ELFObjectFile<ELFT>::getSymbol(DataRefImpl Symb) const {
- return &*toELFSymIter(Symb);
-}
-
-template <class ELFT>
const typename ELFObjectFile<ELFT>::Elf_Rel *
ELFObjectFile<ELFT>::getRel(DataRefImpl Rel) const {
assert(getRelSection(Rel)->sh_type == ELF::SHT_REL);
More information about the llvm-commits
mailing list