[lld] r249586 - ELF2: De-templatize writeResult for simplicity.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 7 11:29:51 PDT 2015
Author: ruiu
Date: Wed Oct 7 13:29:51 2015
New Revision: 249586
URL: http://llvm.org/viewvc/llvm-project?rev=249586&view=rev
Log:
ELF2: De-templatize writeResult for simplicity.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Writer.cpp
lld/trunk/ELF/Writer.h
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=249586&r1=249585&r2=249586&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Oct 7 13:29:51 2015
@@ -224,22 +224,6 @@ void LinkerDriver::link(ArrayRef<const c
if (Config->OutputFile.empty())
Config->OutputFile = "a.out";
- // Write the result.
- const ELFFileBase *FirstObj = Symtab.getFirstELF();
- switch (FirstObj->getELFKind()) {
- case ELF32LEKind:
- writeResult<object::ELF32LE>(&Symtab);
- return;
- case ELF32BEKind:
- writeResult<object::ELF32BE>(&Symtab);
- return;
- case ELF64LEKind:
- writeResult<object::ELF64LE>(&Symtab);
- return;
- case ELF64BEKind:
- writeResult<object::ELF64BE>(&Symtab);
- return;
- default:
- llvm_unreachable("Invalid kind");
- }
+ // Write the result to the file.
+ writeResult(&Symtab);
}
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=249586&r1=249585&r2=249586&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Oct 7 13:29:51 2015
@@ -148,19 +148,24 @@ private:
};
} // anonymous namespace
-namespace lld {
-namespace elf2 {
-
-template <class ELFT>
-void writeResult(SymbolTable *Symtab) { Writer<ELFT>(Symtab).run(); }
-
-template void writeResult<ELF32LE>(SymbolTable *);
-template void writeResult<ELF32BE>(SymbolTable *);
-template void writeResult<ELF64LE>(SymbolTable *);
-template void writeResult<ELF64BE>(SymbolTable *);
-
-} // namespace elf2
-} // namespace lld
+void lld::elf2::writeResult(SymbolTable *Symtab) {
+ switch (Symtab->getFirstELF()->getELFKind()) {
+ case ELF32LEKind:
+ Writer<object::ELF32LE>(Symtab).run();
+ return;
+ case ELF32BEKind:
+ Writer<object::ELF32BE>(Symtab).run();
+ return;
+ case ELF64LEKind:
+ Writer<object::ELF64LE>(Symtab).run();
+ return;
+ case ELF64BEKind:
+ Writer<object::ELF64BE>(Symtab).run();
+ return;
+ default:
+ llvm_unreachable("Invalid kind");
+ }
+}
// The main function of the writer.
template <class ELFT> void Writer<ELFT>::run() {
Modified: lld/trunk/ELF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.h?rev=249586&r1=249585&r2=249586&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.h (original)
+++ lld/trunk/ELF/Writer.h Wed Oct 7 13:29:51 2015
@@ -15,7 +15,6 @@ namespace elf2 {
class SymbolTable;
-template <class ELFT>
void writeResult(SymbolTable *Symtab);
}
More information about the llvm-commits
mailing list