From 515025522bc8d4d57211a78155212bd464574773 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 2 Mar 2016 19:06:20 +0000 Subject: [PATCH] Use C++11 initializers for data members. http://reviews.llvm.org/D17793 llvm-svn: 262501 --- lld/include/lld/ReaderWriter/MachOLinkingContext.h | 52 +++++++++++----------- lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp | 12 +---- 2 files changed, 27 insertions(+), 37 deletions(-) diff --git a/lld/include/lld/ReaderWriter/MachOLinkingContext.h b/lld/include/lld/ReaderWriter/MachOLinkingContext.h index da739b1..dc7ed92 100644 --- a/lld/include/lld/ReaderWriter/MachOLinkingContext.h +++ b/lld/include/lld/ReaderWriter/MachOLinkingContext.h @@ -437,32 +437,32 @@ private: StringRefVector _searchDirs; StringRefVector _syslibRoots; StringRefVector _frameworkDirs; - HeaderFileType _outputMachOType; // e.g MH_EXECUTE - bool _outputMachOTypeStatic; // Disambiguate static vs dynamic prog - bool _doNothing; // for -help and -v which just print info - bool _pie; - Arch _arch; - OS _os; - uint32_t _osMinVersion; + HeaderFileType _outputMachOType = llvm::MachO::MH_EXECUTE; + bool _outputMachOTypeStatic = false; // Disambiguate static vs dynamic prog + bool _doNothing = false; // for -help and -v which just print info + bool _pie = false; + Arch _arch = arch_unknown; + OS _os = OS::macOSX; + uint32_t _osMinVersion = 0; uint32_t _sdkVersion = 0; uint64_t _sourceVersion = 0; - uint64_t _pageZeroSize; - uint64_t _pageSize; - uint64_t _baseAddress; - uint64_t _stackSize; - uint32_t _compatibilityVersion; - uint32_t _currentVersion; - ObjCConstraint _objcConstraint; - uint32_t _swiftVersion; + uint64_t _pageZeroSize = 0; + uint64_t _pageSize = 4096; + uint64_t _baseAddress = 0; + uint64_t _stackSize = 0; + uint32_t _compatibilityVersion = 0; + uint32_t _currentVersion = 0; + ObjCConstraint _objcConstraint = objc_unknown; + uint32_t _swiftVersion = 0; StringRef _installName; StringRefVector _rpaths; - bool _flatNamespace; - UndefinedMode _undefinedMode; - bool _deadStrippableDylib; - bool _printAtoms; - bool _testingFileUsage; - bool _keepPrivateExterns; - bool _demangle; + bool _flatNamespace = false; + UndefinedMode _undefinedMode = UndefinedMode::error; + bool _deadStrippableDylib = false; + bool _printAtoms = false; + bool _testingFileUsage = false; + bool _keepPrivateExterns = false; + bool _demangle = false; bool _mergeObjCCategories = true; bool _generateVersionLoadCommand = false; bool _generateFunctionStartsLoadCommand = false; @@ -476,13 +476,13 @@ private: mutable std::set _upwardDylibs; mutable std::vector> _indirectDylibs; mutable std::mutex _dylibsMutex; - ExportMode _exportMode; + ExportMode _exportMode = ExportMode::globals; llvm::StringSet<> _exportedSymbols; - DebugInfoMode _debugInfoMode; + DebugInfoMode _debugInfoMode = DebugInfoMode::addDebugMap; std::unique_ptr _dependencyInfo; llvm::StringMap> _orderFiles; - unsigned _orderFileEntries; - File *_flatNamespaceFile; + unsigned _orderFileEntries = 0; + File *_flatNamespaceFile = nullptr; mach_o::SectCreateFile *_sectCreateFile = nullptr; }; diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp index a46c5c2..1cc87f0 100644 --- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp +++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp @@ -169,17 +169,7 @@ bool MachOLinkingContext::sliceFromFatFile(MemoryBufferRef mb, uint32_t &offset, return mach_o::normalized::sliceFromFatFile(mb, _arch, offset, size); } -MachOLinkingContext::MachOLinkingContext() - : _outputMachOType(MH_EXECUTE), _outputMachOTypeStatic(false), - _doNothing(false), _pie(false), _arch(arch_unknown), _os(OS::macOSX), - _osMinVersion(0), _pageZeroSize(0), _pageSize(4096), _baseAddress(0), - _stackSize(0), _compatibilityVersion(0), _currentVersion(0), - _objcConstraint(objc_unknown), _swiftVersion(0), _flatNamespace(false), - _undefinedMode(UndefinedMode::error), _deadStrippableDylib(false), - _printAtoms(false), _testingFileUsage(false), _keepPrivateExterns(false), - _demangle(false), _archHandler(nullptr), _exportMode(ExportMode::globals), - _debugInfoMode(DebugInfoMode::addDebugMap), _orderFileEntries(0), - _flatNamespaceFile(nullptr) {} +MachOLinkingContext::MachOLinkingContext() {} MachOLinkingContext::~MachOLinkingContext() {} -- 2.7.4