[PATCH] D41973: Remove ELFDataTypeTypedefHelper class.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 17:45:14 PST 2018


ruiu created this revision.
ruiu added a reviewer: rafael.
Herald added a subscriber: hiraditya.

Remove ELFDataTypeTypedefHelper class.


https://reviews.llvm.org/D41973

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


Index: llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
===================================================================
--- llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ llvm/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 ELFFile<ELFT>::Elf_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/include/llvm/Object/ELFTypes.h
===================================================================
--- llvm/include/llvm/Object/ELFTypes.h
+++ llvm/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.129558.patch
Type: text/x-patch
Size: 3199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180112/ac8e3954/attachment.bin>


More information about the llvm-commits mailing list