[PATCH] D41973: Remove ELFDataTypeTypedefHelper class.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 12:01:06 PST 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL322395: Remove ELFDataTypeTypedefHelper class. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41973?vs=129558&id=129678#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41973

Files:
  llvm/trunk/include/llvm/Object/ELFTypes.h
  llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp


Index: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
===================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -65,7 +65,7 @@
 
   typedef Elf_Ehdr_Impl<ELFT> Elf_Ehdr;
 
-  typedef typename ELFDataTypeTypedefHelper<ELFT>::value_type addr_type;
+  typedef typename ELFT::uint addr_type;
 
   DyldELFObject(ELFObjectFile<ELFT> &&Obj);
 
@@ -149,7 +149,7 @@
 createRTDyldELFObject(MemoryBufferRef Buffer, const ObjectFile &SourceObject,
                       const LoadedELFObjectInfo &L) {
   typedef typename ELFT::Shdr Elf_Shdr;
-  typedef typename ELFDataTypeTypedefHelper<ELFT>::value_type addr_type;
+  typedef typename ELFT::uint addr_type;
 
   Expected<std::unique_ptr<DyldELFObject<ELFT>>> ObjOrErr =
       DyldELFObject<ELFT>::create(Buffer);
Index: llvm/trunk/include/llvm/Object/ELFTypes.h
===================================================================
--- llvm/trunk/include/llvm/Object/ELFTypes.h
+++ llvm/trunk/include/llvm/Object/ELFTypes.h
@@ -90,46 +90,7 @@
 // Use an alignment of 2 for the typedefs since that is the worst case for
 // ELF files in archives.
 
-// Templates to choose Elf_Addr and Elf_Off depending on is64Bits.
-template <endianness target_endianness> struct ELFDataTypeTypedefHelperCommon {
-  using Elf_Half = support::detail::packed_endian_specific_integral<
-      uint16_t, target_endianness, 2>;
-  using Elf_Word = support::detail::packed_endian_specific_integral<
-      uint32_t, target_endianness, 2>;
-  using Elf_Sword = support::detail::packed_endian_specific_integral<
-      int32_t, target_endianness, 2>;
-  using Elf_Xword = support::detail::packed_endian_specific_integral<
-      uint64_t, target_endianness, 2>;
-  using Elf_Sxword = support::detail::packed_endian_specific_integral<
-      int64_t, target_endianness, 2>;
-};
-
-template <class ELFT> struct ELFDataTypeTypedefHelper;
-
-/// ELF 32bit types.
-template <endianness TargetEndianness>
-struct ELFDataTypeTypedefHelper<ELFType<TargetEndianness, false>>
-    : ELFDataTypeTypedefHelperCommon<TargetEndianness> {
-  using value_type = uint32_t;
-  using Elf_Addr = support::detail::packed_endian_specific_integral<
-      value_type, TargetEndianness, 2>;
-  using Elf_Off = support::detail::packed_endian_specific_integral<
-      value_type, TargetEndianness, 2>;
-};
-
-/// ELF 64bit types.
-template <endianness TargetEndianness>
-struct ELFDataTypeTypedefHelper<ELFType<TargetEndianness, true>>
-    : ELFDataTypeTypedefHelperCommon<TargetEndianness> {
-  using value_type = uint64_t;
-  using Elf_Addr = support::detail::packed_endian_specific_integral<
-      value_type, TargetEndianness, 2>;
-  using Elf_Off = support::detail::packed_endian_specific_integral<
-      value_type, TargetEndianness, 2>;
-};
-
 // I really don't like doing this, but the alternative is copypasta.
-
 #define LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)                                       \
   using Elf_Addr = typename ELFT::Addr;                                        \
   using Elf_Off = typename ELFT::Off;                                          \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41973.129678.patch
Type: text/x-patch
Size: 3222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180112/f771c275/attachment.bin>


More information about the llvm-commits mailing list