Remove the EKind member variable.

Now that the base class is templated, it is redundant with the type.

llvm-svn: 250139
This commit is contained in:
Rafael Espindola 2015-10-13 01:17:02 +00:00
parent e5d9515fb7
commit 2a4b27111d
2 changed files with 17 additions and 22 deletions

View File

@ -32,8 +32,8 @@ public:
}
template <class ELFT>
ELFFileBase<ELFT>::ELFFileBase(Kind K, ELFKind EKind, MemoryBufferRef M)
: InputFile(K, M), EKind(EKind), ELFObj(MB.getBuffer(), ECRAII().getEC()) {}
ELFFileBase<ELFT>::ELFFileBase(Kind K, MemoryBufferRef M)
: InputFile(K, M), ELFObj(MB.getBuffer(), ECRAII().getEC()) {}
template <class ELFT>
typename ELFFileBase<ELFT>::Elf_Sym_Range
@ -67,7 +67,7 @@ ELFFileBase<ELFT>::getNonLocalSymbols() {
template <class ELFT>
ObjectFile<ELFT>::ObjectFile(MemoryBufferRef M)
: ELFFileBase<ELFT>(Base::ObjectKind, Base::getStaticELFKind(), M) {}
: ELFFileBase<ELFT>(Base::ObjectKind, M) {}
template <class ELFT>
typename ObjectFile<ELFT>::Elf_Sym_Range ObjectFile<ELFT>::getLocalSymbols() {
@ -258,7 +258,7 @@ std::vector<MemoryBufferRef> ArchiveFile::getMembers() {
template <class ELFT>
SharedFile<ELFT>::SharedFile(MemoryBufferRef M)
: ELFFileBase<ELFT>(Base::SharedKind, Base::getStaticELFKind(), M) {
: ELFFileBase<ELFT>(Base::SharedKind, M) {
AsNeeded = Config->AsNeeded;
}

View File

@ -51,13 +51,22 @@ public:
typedef typename llvm::object::ELFFile<ELFT>::Elf_Shdr Elf_Shdr;
typedef typename llvm::object::ELFFile<ELFT>::Elf_Sym_Range Elf_Sym_Range;
ELFFileBase(Kind K, ELFKind EKind, MemoryBufferRef M);
ELFFileBase(Kind K, MemoryBufferRef M);
static bool classof(const InputFile *F) {
Kind K = F->kind();
return K == ObjectKind || K == SharedKind;
}
ELFKind getELFKind() const { return EKind; }
static ELFKind getELFKind() {
if (!ELFT::Is64Bits) {
if (ELFT::TargetEndianness == llvm::support::little)
return ELF32LEKind;
return ELF32BEKind;
}
if (ELFT::TargetEndianness == llvm::support::little)
return ELF64LEKind;
return ELF64BEKind;
}
const llvm::object::ELFFile<ELFT> &getObj() const { return ELFObj; }
llvm::object::ELFFile<ELFT> &getObj() { return ELFObj; }
@ -70,18 +79,6 @@ public:
StringRef getStringTable() const { return StringTable; }
protected:
static ELFKind getStaticELFKind() {
if (!ELFT::Is64Bits) {
if (ELFT::TargetEndianness == llvm::support::little)
return ELF32LEKind;
return ELF32BEKind;
}
if (ELFT::TargetEndianness == llvm::support::little)
return ELF64LEKind;
return ELF64BEKind;
}
const ELFKind EKind;
llvm::object::ELFFile<ELFT> ELFObj;
const Elf_Shdr *Symtab = nullptr;
StringRef StringTable;
@ -105,8 +102,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() == Base::getStaticELFKind();
return F->kind() == Base::ObjectKind;
}
ArrayRef<SymbolBody *> getSymbols() { return this->SymbolBodies; }
@ -182,8 +178,7 @@ public:
}
static bool classof(const InputFile *F) {
return F->kind() == Base::SharedKind &&
cast<ELFFileBase<ELFT>>(F)->getELFKind() == Base::getStaticELFKind();
return F->kind() == Base::SharedKind;
}
explicit SharedFile(MemoryBufferRef M);