[lld] r233438 - ELF: Do not use llvm::Optional for _maxPageSize.

Rui Ueyama ruiu at google.com
Fri Mar 27 15:28:36 PDT 2015


Author: ruiu
Date: Fri Mar 27 17:28:35 2015
New Revision: 233438

URL: http://llvm.org/viewvc/llvm-project?rev=233438&view=rev
Log:
ELF: Do not use llvm::Optional for _maxPageSize.

Use of llvm::Optional seems useless here because we can set the
default value 0x1000 as an initial value to the varaible.
This patch also de-virtualize the accessor functions.

Modified:
    lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h

Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=233438&r1=233437&r2=233438&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Fri Mar 27 17:28:35 2015
@@ -64,16 +64,8 @@ public:
 
   llvm::Triple getTriple() const { return _triple; }
 
-  // Page size.
-  virtual uint64_t getPageSize() const {
-    if (_maxPageSize)
-      return *_maxPageSize;
-    return 0x1000;
-  }
-
-  virtual void setMaxPageSize(uint64_t pagesize) {
-    _maxPageSize = pagesize;
-  }
+  uint64_t getPageSize() const { return _maxPageSize; }
+  void setMaxPageSize(uint64_t v) { _maxPageSize = v; }
 
   OutputMagic getOutputMagic() const { return _outputMagic; }
   uint16_t getOutputELFType() const { return _outputELFType; }
@@ -335,7 +327,7 @@ protected:
   bool _stripSymbols = false;
   bool _alignSegments = true;
   bool _collectStats = false;
-  llvm::Optional<uint64_t> _maxPageSize;
+  uint64_t _maxPageSize = 0x1000;
 
   OutputMagic _outputMagic;
   StringRefVector _inputSearchPaths;





More information about the llvm-commits mailing list