[lld] r233434 - ELF: Use C++11 non-member initialization.

Rui Ueyama ruiu at google.com
Fri Mar 27 15:10:29 PDT 2015


Author: ruiu
Date: Fri Mar 27 17:10:29 2015
New Revision: 233434

URL: http://llvm.org/viewvc/llvm-project?rev=233434&view=rev
Log:
ELF: Use C++11 non-member initialization.

Modified:
    lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
    lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp

Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=233434&r1=233433&r2=233434&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Fri Mar 27 17:10:29 2015
@@ -312,38 +312,40 @@ private:
   ELFLinkingContext() = delete;
 
 protected:
-  ELFLinkingContext(llvm::Triple, std::unique_ptr<TargetHandlerBase>);
+  ELFLinkingContext(llvm::Triple triple,
+                    std::unique_ptr<TargetHandlerBase> targetHandler)
+      : _triple(triple), _targetHandler(std::move(targetHandler)) {}
 
   Writer &writer() const override;
 
   /// Method to create a internal file for an undefined symbol
   std::unique_ptr<File> createUndefinedSymbolFile() const override;
 
-  uint16_t _outputELFType; // e.g ET_EXEC
+  uint16_t _outputELFType = llvm::ELF::ET_EXEC;
   llvm::Triple _triple;
   std::unique_ptr<TargetHandlerBase> _targetHandler;
-  uint64_t _baseAddress;
-  bool _isStaticExecutable;
-  bool _noInhibitExec;
-  bool _exportDynamic;
-  bool _mergeCommonStrings;
-  bool _useShlibUndefines;
-  bool _dynamicLinkerArg;
-  bool _noAllowDynamicLibraries;
-  bool _mergeRODataToTextSegment;
-  bool _demangle;
-  bool _stripSymbols;
-  bool _alignSegments;
-  bool _collectStats;
+  uint64_t _baseAddress = 0;
+  bool _isStaticExecutable = false;
+  bool _noInhibitExec = false;
+  bool _exportDynamic = false;
+  bool _mergeCommonStrings = false;
+  bool _useShlibUndefines = true;
+  bool _dynamicLinkerArg = false;
+  bool _noAllowDynamicLibraries = false;
+  bool _mergeRODataToTextSegment = true;
+  bool _demangle = true;
+  bool _stripSymbols = false;
+  bool _alignSegments = true;
+  bool _collectStats = false;
   llvm::Optional<uint64_t> _maxPageSize;
 
   OutputMagic _outputMagic;
   StringRefVector _inputSearchPaths;
   std::unique_ptr<Writer> _writer;
   StringRef _dynamicLinkerPath;
-  StringRef _initFunction;
-  StringRef _finiFunction;
-  StringRef _sysrootPath;
+  StringRef _initFunction = "_init";
+  StringRef _finiFunction = "_fini";
+  StringRef _sysrootPath = "";
   StringRef _soname;
   StringRefVector _rpathList;
   StringRefVector _rpathLinkList;

Modified: lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=233434&r1=233433&r2=233434&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Fri Mar 27 17:10:29 2015
@@ -37,18 +37,6 @@ public:
   }
 };
 
-ELFLinkingContext::ELFLinkingContext(
-    llvm::Triple triple, std::unique_ptr<TargetHandlerBase> targetHandler)
-    : _outputELFType(llvm::ELF::ET_EXEC), _triple(triple),
-      _targetHandler(std::move(targetHandler)), _baseAddress(0),
-      _isStaticExecutable(false), _noInhibitExec(false), _exportDynamic(false),
-      _mergeCommonStrings(false), _useShlibUndefines(true),
-      _dynamicLinkerArg(false), _noAllowDynamicLibraries(false),
-      _mergeRODataToTextSegment(true), _demangle(true),
-      _stripSymbols(false), _alignSegments(true), _collectStats(false),
-      _outputMagic(OutputMagic::DEFAULT), _initFunction("_init"),
-      _finiFunction("_fini"), _sysrootPath(""), _linkerScriptSema() {}
-
 void ELFLinkingContext::addPasses(PassManager &pm) {
   pm.add(llvm::make_unique<elf::OrderPass>());
 }





More information about the llvm-commits mailing list