From f1d0d777c9a09c02220eba7a3a4af990a430dd40 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 21 Oct 2013 22:37:14 +0000 Subject: [PATCH] Revert "Initialize some members where they are declared." Because MSVC11 doesn't like this new C++11 feature. The last commit broke the buildbot. llvm-svn: 193127 --- lld/lib/Driver/WinLinkDriver.cpp | 2 -- lld/lib/ReaderWriter/PECOFF/Atoms.h | 15 +++++++++------ lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp | 15 ++++++++------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp index 0dfc73386f21..1fc008c22c18 100644 --- a/lld/lib/Driver/WinLinkDriver.cpp +++ b/lld/lib/Driver/WinLinkDriver.cpp @@ -204,8 +204,6 @@ StringRef getDefaultEntrySymbolName(PECOFFLinkingContext &context) { return ""; } - - // Parses the given command line options and returns the result. Returns NULL if // there's an error in the options. std::unique_ptr diff --git a/lld/lib/ReaderWriter/PECOFF/Atoms.h b/lld/lib/ReaderWriter/PECOFF/Atoms.h index 08d714dcaed8..2326ab849366 100644 --- a/lld/lib/ReaderWriter/PECOFF/Atoms.h +++ b/lld/lib/ReaderWriter/PECOFF/Atoms.h @@ -26,7 +26,9 @@ class COFFDefinedAtom; /// to be fixed up so that the address points to atom Y's address. class COFFReference LLVM_FINAL : public Reference { public: - explicit COFFReference(Kind kind) { _kind = kind; } + explicit COFFReference(Kind kind) : _target(nullptr), _offsetInAtom(0) { + _kind = kind; + } COFFReference(const Atom *target, uint32_t offsetInAtom, uint16_t relocType) : _target(target), _offsetInAtom(offsetInAtom) { @@ -46,8 +48,8 @@ public: virtual uint64_t offsetInAtom() const { return _offsetInAtom; } private: - const Atom *_target = nullptr; - uint32_t _offsetInAtom = 0; + const Atom *_target; + uint32_t _offsetInAtom; }; class COFFAbsoluteAtom : public AbsoluteAtom { @@ -150,7 +152,7 @@ public: ContentPermissions perms, uint64_t ordinal) : COFFBaseDefinedAtom(file, name, Kind::File), _sectionName(sectionName), _scope(scope), _contentType(contentType), _permissions(perms), - _ordinal(ordinal) {} + _ordinal(ordinal), _alignment(0) {} static bool classof(const COFFBaseDefinedAtom *atom) { return atom->getKind() == Kind::File; @@ -171,7 +173,7 @@ private: ContentType _contentType; ContentPermissions _permissions; uint64_t _ordinal; - Alignment _alignment = 0; + Alignment _alignment; std::vector> _references; }; @@ -273,7 +275,8 @@ public: COFFSharedLibraryAtom(const File &file, uint16_t hint, StringRef symbolName, StringRef importName, StringRef dllName) : _file(file), _hint(hint), _mangledName(addImpPrefix(symbolName)), - _importName(importName), _dllName(dllName) {} + _importName(importName), _dllName(dllName), + _importTableEntry(nullptr) {} virtual const File &file() const { return _file; } uint16_t hint() const { return _hint; } diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp index 27194ddff142..630d94ae3112 100644 --- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp @@ -73,7 +73,7 @@ public: kindDataDirectory }; - explicit Chunk(Kind kind) : _kind(kind) {} + explicit Chunk(Kind kind) : _kind(kind), _size(0), _align(1) {} virtual ~Chunk() {}; virtual void write(uint8_t *fileBuffer) = 0; @@ -89,9 +89,9 @@ public: protected: Kind _kind; - uint64_t _size = 0; + uint64_t _size; uint64_t _fileOffset; - uint64_t _align = 1; + uint64_t _align; }; /// A HeaderChunk is an abstract class to represent a file header for @@ -802,7 +802,8 @@ private: class ExecutableWriter : public Writer { public: explicit ExecutableWriter(const PECOFFLinkingContext &context) - : _PECOFFLinkingContext(context) {} + : _PECOFFLinkingContext(context), _numSections(0), + _imageSizeInMemory(PAGE_SIZE), _imageSizeOnDisk(0) {} // Create all chunks that consist of the output file. void build(const File &linkedFile) { @@ -977,17 +978,17 @@ private: std::vector> _chunks; const PECOFFLinkingContext &_PECOFFLinkingContext; - uint32_t _numSections = 0; + uint32_t _numSections; // The size of the image in memory. This is initialized with PAGE_SIZE, as the // first page starting at ImageBase is usually left unmapped. IIUC there's no // technical reason to do so, but we'll follow that convention so that we // don't produce odd-looking binary. - uint32_t _imageSizeInMemory = PAGE_SIZE; + uint32_t _imageSizeInMemory; // The size of the image on disk. This is basically the sum of all chunks in // the output file with paddings between them. - uint32_t _imageSizeOnDisk = 0; + uint32_t _imageSizeOnDisk; // The map from defined atoms to its RVAs. Will be used for relocation. std::map atomRva; -- 2.34.1