OSDN Git Service

Use more strict types. NFC.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 1 Oct 2015 15:22:42 +0000 (15:22 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 1 Oct 2015 15:22:42 +0000 (15:22 +0000)
On 32 bit ELF these are 32 bit values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249022 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/ELFTypes.h

index 2cc67bb..d9f261e 100644 (file)
@@ -306,14 +306,18 @@ struct Elf_Dyn_Base<ELFType<TargetEndianness, true>> {
   } d_un;
 };
 
-/// Elf_Dyn_Impl: This inherits from Elf_Dyn_Base, adding getters and setters.
+/// Elf_Dyn_Impl: This inherits from Elf_Dyn_Base, adding getters.
 template <class ELFT>
 struct Elf_Dyn_Impl : Elf_Dyn_Base<ELFT> {
   using Elf_Dyn_Base<ELFT>::d_tag;
   using Elf_Dyn_Base<ELFT>::d_un;
-  int64_t getTag() const { return d_tag; }
-  uint64_t getVal() const { return d_un.d_val; }
-  uint64_t getPtr() const { return d_un.d_ptr; }
+  typedef typename std::conditional<ELFT::Is64Bits,
+                                    int64_t, int32_t>::type intX_t;
+  typedef typename std::conditional<ELFT::Is64Bits,
+                                    uint64_t, uint32_t>::type uintX_t;
+  intX_t getTag() const { return d_tag; }
+  uintX_t getVal() const { return d_un.d_val; }
+  uintX_t getPtr() const { return d_un.d_ptr; }
 };
 
 // Elf_Rel: Elf Relocation