[lld] r265758 - Simplify createELFFile. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 7 17:18:26 PDT 2016
Author: ruiu
Date: Thu Apr 7 19:18:25 2016
New Revision: 265758
URL: http://llvm.org/viewvc/llvm-project?rev=265758&view=rev
Log:
Simplify createELFFile. NFC.
Modified:
lld/trunk/ELF/InputFiles.cpp
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=265758&r1=265757&r2=265758&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Thu Apr 7 19:18:25 2016
@@ -536,17 +536,19 @@ static std::unique_ptr<InputFile> create
template <template <class> class T>
static std::unique_ptr<InputFile> createELFFile(MemoryBufferRef MB) {
- std::pair<unsigned char, unsigned char> Type = getElfArchType(MB.getBuffer());
- if (Type.second != ELF::ELFDATA2LSB && Type.second != ELF::ELFDATA2MSB)
+ unsigned char Size;
+ unsigned char Endian;
+ std::tie(Size, Endian) = getElfArchType(MB.getBuffer());
+ if (Endian != ELFDATA2LSB && Endian != ELFDATA2MSB)
fatal("invalid data encoding: " + MB.getBufferIdentifier());
- if (Type.first == ELF::ELFCLASS32) {
- if (Type.second == ELF::ELFDATA2LSB)
+ if (Size == ELFCLASS32) {
+ if (Endian == ELFDATA2LSB)
return createELFFileAux<T<ELF32LE>>(MB);
return createELFFileAux<T<ELF32BE>>(MB);
}
- if (Type.first == ELF::ELFCLASS64) {
- if (Type.second == ELF::ELFDATA2LSB)
+ if (Size == ELFCLASS64) {
+ if (Endian == ELFDATA2LSB)
return createELFFileAux<T<ELF64LE>>(MB);
return createELFFileAux<T<ELF64BE>>(MB);
}
More information about the llvm-commits
mailing list