diff options
-rw-r--r-- | lld/ELF/InputFiles.cpp | 4 | ||||
-rw-r--r-- | lld/ELF/InputFiles.h | 24 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index cbb1164ca36..80f20ec13be 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -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; } diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index 34ce2bd4c34..2701fac6039 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -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); |