Detemplate isCompatible(). NFC.

llvm-svn: 321393
This commit is contained in:
Rafael Espindola 2017-12-23 00:04:34 +00:00
parent f10cc02591
commit 9f37543cf8
2 changed files with 9 additions and 7 deletions

View File

@ -72,6 +72,11 @@ public:
Kind kind() const { return FileKind; }
bool isElf() const {
Kind K = kind();
return K == ObjKind || K == SharedKind;
}
StringRef getName() const { return MB.getBufferIdentifier(); }
MemoryBufferRef MB;
@ -121,10 +126,7 @@ public:
typedef typename ELFT::SymRange Elf_Sym_Range;
ELFFileBase(Kind K, MemoryBufferRef M);
static bool classof(const InputFile *F) {
Kind K = F->kind();
return K == ObjKind || K == SharedKind;
}
static bool classof(const InputFile *F) { return F->isElf(); }
llvm::object::ELFFile<ELFT> getObj() const {
return check(llvm::object::ELFFile<ELFT>::create(MB.getBuffer()));

View File

@ -44,8 +44,8 @@ static InputFile *getFirstElf() {
// All input object files must be for the same architecture
// (e.g. it does not make sense to link x86 object files with
// MIPS object files.) This function checks for that error.
template <class ELFT> static bool isCompatible(InputFile *F) {
if (!isa<ELFFileBase<ELFT>>(F) && !isa<BitcodeFile>(F))
static bool isCompatible(InputFile *F) {
if (!F->isElf() && !isa<BitcodeFile>(F))
return true;
if (F->EKind == Config->EKind && F->EMachine == Config->EMachine) {
@ -64,7 +64,7 @@ template <class ELFT> static bool isCompatible(InputFile *F) {
// Add symbols in File to the symbol table.
template <class ELFT> void SymbolTable::addFile(InputFile *File) {
if (!isCompatible<ELFT>(File))
if (!isCompatible(File))
return;
// Binary file