[lld] r193122 - Initialize some members where they are declared. No functionality change.
Rui Ueyama
ruiu at google.com
Mon Oct 21 15:25:03 PDT 2013
Author: ruiu
Date: Mon Oct 21 17:25:02 2013
New Revision: 193122
URL: http://llvm.org/viewvc/llvm-project?rev=193122&view=rev
Log:
Initialize some members where they are declared. No functionality change.
Modified:
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=193122&r1=193121&r2=193122&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Mon Oct 21 17:25:02 2013
@@ -204,6 +204,8 @@ StringRef getDefaultEntrySymbolName(PECO
return "";
}
+
+
// Parses the given command line options and returns the result. Returns NULL if
// there's an error in the options.
std::unique_ptr<llvm::opt::InputArgList>
Modified: lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h?rev=193122&r1=193121&r2=193122&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h Mon Oct 21 17:25:02 2013
@@ -26,9 +26,7 @@ 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) : _target(nullptr), _offsetInAtom(0) {
- _kind = kind;
- }
+ explicit COFFReference(Kind kind) { _kind = kind; }
COFFReference(const Atom *target, uint32_t offsetInAtom, uint16_t relocType)
: _target(target), _offsetInAtom(offsetInAtom) {
@@ -48,8 +46,8 @@ public:
virtual uint64_t offsetInAtom() const { return _offsetInAtom; }
private:
- const Atom *_target;
- uint32_t _offsetInAtom;
+ const Atom *_target = nullptr;
+ uint32_t _offsetInAtom = 0;
};
class COFFAbsoluteAtom : public AbsoluteAtom {
@@ -152,7 +150,7 @@ public:
ContentPermissions perms, uint64_t ordinal)
: COFFBaseDefinedAtom(file, name, Kind::File), _sectionName(sectionName),
_scope(scope), _contentType(contentType), _permissions(perms),
- _ordinal(ordinal), _alignment(0) {}
+ _ordinal(ordinal) {}
static bool classof(const COFFBaseDefinedAtom *atom) {
return atom->getKind() == Kind::File;
@@ -173,7 +171,7 @@ private:
ContentType _contentType;
ContentPermissions _permissions;
uint64_t _ordinal;
- Alignment _alignment;
+ Alignment _alignment = 0;
std::vector<std::unique_ptr<COFFReference>> _references;
};
@@ -275,8 +273,7 @@ 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),
- _importTableEntry(nullptr) {}
+ _importName(importName), _dllName(dllName) {}
virtual const File &file() const { return _file; }
uint16_t hint() const { return _hint; }
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=193122&r1=193121&r2=193122&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Mon Oct 21 17:25:02 2013
@@ -73,7 +73,7 @@ public:
kindDataDirectory
};
- explicit Chunk(Kind kind) : _kind(kind), _size(0), _align(1) {}
+ explicit Chunk(Kind kind) : _kind(kind) {}
virtual ~Chunk() {};
virtual void write(uint8_t *fileBuffer) = 0;
@@ -89,9 +89,9 @@ public:
protected:
Kind _kind;
- uint64_t _size;
+ uint64_t _size = 0;
uint64_t _fileOffset;
- uint64_t _align;
+ uint64_t _align = 1;
};
/// A HeaderChunk is an abstract class to represent a file header for
@@ -802,8 +802,7 @@ private:
class ExecutableWriter : public Writer {
public:
explicit ExecutableWriter(const PECOFFLinkingContext &context)
- : _PECOFFLinkingContext(context), _numSections(0),
- _imageSizeInMemory(PAGE_SIZE), _imageSizeOnDisk(0) {}
+ : _PECOFFLinkingContext(context) {}
// Create all chunks that consist of the output file.
void build(const File &linkedFile) {
@@ -978,17 +977,17 @@ private:
std::vector<std::unique_ptr<Chunk>> _chunks;
const PECOFFLinkingContext &_PECOFFLinkingContext;
- uint32_t _numSections;
+ uint32_t _numSections = 0;
// 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;
+ uint32_t _imageSizeInMemory = PAGE_SIZE;
// 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;
+ uint32_t _imageSizeOnDisk = 0;
// The map from defined atoms to its RVAs. Will be used for relocation.
std::map<const Atom *, uint64_t> atomRva;
More information about the llvm-commits
mailing list