[lld] r233549 - [Mips] Do not use llvm::Optional for GP0 value and TLS section address

Simon Atanasyan simon at atanasyan.com
Mon Mar 30 08:07:11 PDT 2015


Author: atanasyan
Date: Mon Mar 30 10:07:11 2015
New Revision: 233549

URL: http://llvm.org/viewvc/llvm-project?rev=233549&view=rev
Log:
[Mips] Do not use llvm::Optional for GP0 value and TLS section address

Use of llvm::Optional is redundant here. Initializing by default value 0
is enough.

No functional changes.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=233549&r1=233548&r2=233549&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h Mon Mar 30 10:07:11 2015
@@ -136,11 +136,11 @@ public:
   }
 
   /// \brief gp register value stored in the .reginfo section.
-  int64_t getGP0() const { return _gp0 ? *_gp0 : 0; }
+  int64_t getGP0() const { return _gp0; }
 
   /// \brief .tdata section address plus fixed offset.
-  uint64_t getTPOffset() const { return *_tpOff; }
-  uint64_t getDTPOffset() const { return *_dtpOff; }
+  uint64_t getTPOffset() const { return _tpOff; }
+  uint64_t getDTPOffset() const { return _dtpOff; }
 
 protected:
   std::error_code doParse() override {
@@ -163,9 +163,9 @@ private:
   static const bool _isMips64EL =
       ELFT::Is64Bits && ELFT::TargetEndianness == llvm::support::little;
 
-  llvm::Optional<int64_t> _gp0;
-  llvm::Optional<uint64_t> _tpOff;
-  llvm::Optional<uint64_t> _dtpOff;
+  int64_t _gp0 = 0;
+  uint64_t _tpOff = 0;
+  uint64_t _dtpOff = 0;
 
   ErrorOr<ELFDefinedAtom<ELFT> *> handleDefinedSymbol(
       StringRef symName, StringRef sectionName, const Elf_Sym *sym,





More information about the llvm-commits mailing list