ELF: Use C++11 non-member initialization.
authorRui Ueyama <ruiu@google.com>
Fri, 27 Mar 2015 22:10:29 +0000 (22:10 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 27 Mar 2015 22:10:29 +0000 (22:10 +0000)
llvm-svn: 233434

lld/include/lld/ReaderWriter/ELFLinkingContext.h
lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp

index 81d9b58ab527164317903ee7559442a7324816ec..1e3e04b929818da9bd64e35fd1035d1d1aaff7a6 100644 (file)
@@ -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;
index c7dffda8a463ee20806c8b32b8af43136e05b186..4d5c9a8046e908243ace31a708de60e1a1d7c3b0 100644 (file)
@@ -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>());
 }