[llvm] r286351 - [mips] Add non-const getter for the Elf_Mips_Options class. NFC

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 02:14:55 PST 2016


Author: atanasyan
Date: Wed Nov  9 04:14:55 2016
New Revision: 286351

URL: http://llvm.org/viewvc/llvm-project?rev=286351&view=rev
Log:
[mips] Add non-const getter for the Elf_Mips_Options class. NFC

Modified:
    llvm/trunk/include/llvm/Object/ELFTypes.h

Modified: llvm/trunk/include/llvm/Object/ELFTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFTypes.h?rev=286351&r1=286350&r2=286351&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFTypes.h (original)
+++ llvm/trunk/include/llvm/Object/ELFTypes.h Wed Nov  9 04:14:55 2016
@@ -608,10 +608,13 @@ template <class ELFT> struct Elf_Mips_Op
                     // or 0 for global options
   Elf_Word info;    // Kind-specific information
 
-  const Elf_Mips_RegInfo<ELFT> &getRegInfo() const {
+  Elf_Mips_RegInfo<ELFT> &getRegInfo() {
     assert(kind == llvm::ELF::ODK_REGINFO);
-    return *reinterpret_cast<const Elf_Mips_RegInfo<ELFT> *>(
-               (const uint8_t *)this + sizeof(Elf_Mips_Options));
+    return *reinterpret_cast<Elf_Mips_RegInfo<ELFT> *>(
+        (uint8_t *)this + sizeof(Elf_Mips_Options));
+  }
+  const Elf_Mips_RegInfo<ELFT> &getRegInfo() const {
+    return const_cast<Elf_Mips_Options *>(this)->getRegInfo();
   }
 };
 




More information about the llvm-commits mailing list