[lld] r321393 - Detemplate isCompatible(). NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 22 16:04:34 PST 2017
Author: rafael
Date: Fri Dec 22 16:04:34 2017
New Revision: 321393
URL: http://llvm.org/viewvc/llvm-project?rev=321393&view=rev
Log:
Detemplate isCompatible(). NFC.
Modified:
lld/trunk/ELF/InputFiles.h
lld/trunk/ELF/SymbolTable.cpp
Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=321393&r1=321392&r2=321393&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Fri Dec 22 16:04:34 2017
@@ -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()));
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=321393&r1=321392&r2=321393&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Fri Dec 22 16:04:34 2017
@@ -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 isComp
// 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
More information about the llvm-commits
mailing list