[lld] r233948 - ELF: Remove <Arch>ELFFileCreateELFTraits::result_type.
Rui Ueyama
ruiu at google.com
Thu Apr 2 14:14:34 PDT 2015
Author: ruiu
Date: Thu Apr 2 16:14:33 2015
New Revision: 233948
URL: http://llvm.org/viewvc/llvm-project?rev=233948&view=rev
Log:
ELF: Remove <Arch>ELFFileCreateELFTraits::result_type.
result_type is always ErrorOr<unique_ptr<File>>, and since the type traits
is for instantiating ELF files, it's unlikely that we want to return
something else. This patch removes that type.
Modified:
lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h
lld/trunk/lib/ReaderWriter/ELF/ARM/ARMELFReader.h
lld/trunk/lib/ReaderWriter/ELF/CreateELF.h
lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonELFReader.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h
lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h
lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h
Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h?rev=233948&r1=233947&r2=233948&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h Thu Apr 2 16:14:33 2015
@@ -20,11 +20,9 @@ class AArch64LinkingContext;
typedef llvm::object::ELFType<llvm::support::little, 2, true> AArch64ELFType;
struct AArch64ELFFileCreateELFTraits {
- typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
-
template <class ELFT>
- static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
- AArch64LinkingContext &ctx) {
+ static llvm::ErrorOr<std::unique_ptr<lld::File>>
+ create(std::unique_ptr<llvm::MemoryBuffer> mb, AArch64LinkingContext &ctx) {
return lld::elf::ELFFile<ELFT>::create(std::move(mb), ctx);
}
};
Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMELFReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMELFReader.h?rev=233948&r1=233947&r2=233948&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMELFReader.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMELFReader.h Thu Apr 2 16:14:33 2015
@@ -19,11 +19,9 @@ namespace elf {
typedef llvm::object::ELFType<llvm::support::little, 2, false> ARMELFType;
struct ARMELFFileCreateELFTraits {
- typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
-
template <class ELFT>
- static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
- ARMLinkingContext &ctx) {
+ static llvm::ErrorOr<std::unique_ptr<lld::File>>
+ create(std::unique_ptr<llvm::MemoryBuffer> mb, ARMLinkingContext &ctx) {
return lld::elf::ARMELFFile<ELFT>::create(std::move(mb), ctx);
}
};
Modified: lld/trunk/lib/ReaderWriter/ELF/CreateELF.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/CreateELF.h?rev=233948&r1=233947&r2=233948&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/CreateELF.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/CreateELF.h Thu Apr 2 16:14:33 2015
@@ -16,6 +16,7 @@
#ifndef LLD_READER_WRITER_ELF_CREATE_ELF_H
#define LLD_READER_WRITER_ELF_CREATE_ELF_H
+#include "lld/Core/File.h"
#include "llvm/Object/ELF.h"
#include "llvm/Support/Compiler.h"
@@ -27,9 +28,8 @@ using llvm::object::ELFType;
/// of an ELF file.
///
/// \param Traits
-/// Traits::result_type must be a type convertable from what create returns.
/// Traits::create must be a template function which takes an ELFType and
-/// returns something convertable to Traits::result_type.
+/// returns an ErrorOr<std::unique_ptr<lld::File>>.
///
/// \param ident pair of EI_CLASS and EI_DATA.
/// \param maxAlignment the maximum alignment of the file.
@@ -55,10 +55,10 @@ using llvm::object::ELFType;
llvm_unreachable("Invalid alignment for ELF file!");
#endif
-template <class Traits, class ...Args>
-typename Traits::result_type createELF(
- std::pair<unsigned char, unsigned char> ident, std::size_t maxAlignment,
- Args &&...args) {
+template <class Traits, class... Args>
+llvm::ErrorOr<std::unique_ptr<lld::File>>
+createELF(std::pair<unsigned char, unsigned char> ident,
+ std::size_t maxAlignment, Args &&... args) {
if (ident.first == llvm::ELF::ELFCLASS32 &&
ident.second == llvm::ELF::ELFDATA2LSB) {
LLVM_CREATE_ELF_Create(4, 2, little, false, std::forward<Args>(args)...)
Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonELFReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonELFReader.h?rev=233948&r1=233947&r2=233948&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonELFReader.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonELFReader.h Thu Apr 2 16:14:33 2015
@@ -19,11 +19,9 @@ namespace elf {
typedef llvm::object::ELFType<llvm::support::little, 2, false> HexagonELFType;
struct HexagonELFFileCreateELFTraits {
- typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
-
template <class ELFT>
- static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
- HexagonLinkingContext &ctx) {
+ static llvm::ErrorOr<std::unique_ptr<lld::File>>
+ create(std::unique_ptr<llvm::MemoryBuffer> mb, HexagonLinkingContext &ctx) {
return lld::elf::HexagonELFFile<ELFT>::create(std::move(mb), ctx);
}
};
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h?rev=233948&r1=233947&r2=233948&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h Thu Apr 2 16:14:33 2015
@@ -18,11 +18,9 @@ namespace lld {
namespace elf {
struct MipsELFFileCreateTraits {
- typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
-
template <class ELFT>
- static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
- MipsLinkingContext &ctx) {
+ static llvm::ErrorOr<std::unique_ptr<lld::File>>
+ create(std::unique_ptr<llvm::MemoryBuffer> mb, MipsLinkingContext &ctx) {
return lld::elf::MipsELFFile<ELFT>::create(std::move(mb), ctx);
}
};
Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h?rev=233948&r1=233947&r2=233948&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h Thu Apr 2 16:14:33 2015
@@ -19,11 +19,9 @@ class X86LinkingContext;
typedef llvm::object::ELFType<llvm::support::little, 2, false> X86ELFType;
struct X86ELFFileCreateELFTraits {
- typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
-
template <class ELFT>
- static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
- X86LinkingContext &ctx) {
+ static llvm::ErrorOr<std::unique_ptr<lld::File>>
+ create(std::unique_ptr<llvm::MemoryBuffer> mb, X86LinkingContext &ctx) {
return lld::elf::ELFFile<ELFT>::create(std::move(mb), ctx);
}
};
Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h?rev=233948&r1=233947&r2=233948&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h Thu Apr 2 16:14:33 2015
@@ -19,11 +19,9 @@ class X86_64LinkingContext;
typedef llvm::object::ELFType<llvm::support::little, 2, true> X86_64ELFType;
struct X86_64ELFFileCreateELFTraits {
- typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
-
template <class ELFT>
- static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
- X86_64LinkingContext &ctx) {
+ static llvm::ErrorOr<std::unique_ptr<lld::File>>
+ create(std::unique_ptr<llvm::MemoryBuffer> mb, X86_64LinkingContext &ctx) {
return lld::elf::ELFFile<ELFT>::create(std::move(mb), ctx);
}
};
More information about the llvm-commits
mailing list