Make getStaticELFKind a member function now that we can.

llvm-svn: 250031
This commit is contained in:
Rafael Espindola 2015-10-12 12:14:30 +00:00
parent b9ca7bb6ab
commit fb677dfd73
2 changed files with 14 additions and 14 deletions

View File

@ -67,7 +67,7 @@ ELFFileBase<ELFT>::getNonLocalSymbols() {
template <class ELFT>
ObjectFile<ELFT>::ObjectFile(MemoryBufferRef M)
: ELFFileBase<ELFT>(Base::ObjectKind, getStaticELFKind<ELFT>(), M) {}
: ELFFileBase<ELFT>(Base::ObjectKind, Base::getStaticELFKind(), M) {}
template <class ELFT>
typename ObjectFile<ELFT>::Elf_Sym_Range ObjectFile<ELFT>::getLocalSymbols() {
@ -260,7 +260,7 @@ std::vector<MemoryBufferRef> ArchiveFile::getMembers() {
template <class ELFT>
SharedFile<ELFT>::SharedFile(MemoryBufferRef M)
: ELFFileBase<ELFT>(Base::SharedKind, getStaticELFKind<ELFT>(), M) {
: ELFFileBase<ELFT>(Base::SharedKind, Base::getStaticELFKind(), M) {
AsNeeded = Config->AsNeeded;
}

View File

@ -70,16 +70,7 @@ public:
StringRef getStringTable() const { return StringTable; }
protected:
const ELFKind EKind;
llvm::object::ELFFile<ELFT> ELFObj;
const Elf_Shdr *Symtab = nullptr;
StringRef StringTable;
void initStringTable();
Elf_Sym_Range getNonLocalSymbols();
Elf_Sym_Range getSymbolsHelper(bool);
};
template <class ELFT> static ELFKind getStaticELFKind() {
static ELFKind getStaticELFKind() {
if (!ELFT::Is64Bits) {
if (ELFT::TargetEndianness == llvm::support::little)
return ELF32LEKind;
@ -90,6 +81,15 @@ template <class ELFT> static ELFKind getStaticELFKind() {
return ELF64BEKind;
}
const ELFKind EKind;
llvm::object::ELFFile<ELFT> ELFObj;
const Elf_Shdr *Symtab = nullptr;
StringRef StringTable;
void initStringTable();
Elf_Sym_Range getNonLocalSymbols();
Elf_Sym_Range getSymbolsHelper(bool);
};
// .o file.
template <class ELFT> class ObjectFile : public ELFFileBase<ELFT> {
typedef ELFFileBase<ELFT> Base;
@ -106,7 +106,7 @@ template <class ELFT> class ObjectFile : public ELFFileBase<ELFT> {
public:
static bool classof(const InputFile *F) {
return F->kind() == Base::ObjectKind &&
cast<ELFFileBase<ELFT>>(F)->getELFKind() == getStaticELFKind<ELFT>();
cast<ELFFileBase<ELFT>>(F)->getELFKind() == Base::getStaticELFKind();
}
ArrayRef<SymbolBody *> getSymbols() { return this->SymbolBodies; }
@ -183,7 +183,7 @@ public:
static bool classof(const InputFile *F) {
return F->kind() == Base::SharedKind &&
cast<ELFFileBase<ELFT>>(F)->getELFKind() == getStaticELFKind<ELFT>();
cast<ELFFileBase<ELFT>>(F)->getELFKind() == Base::getStaticELFKind();
}
explicit SharedFile(MemoryBufferRef M);