summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-04-01 22:28:00 +0000
committerRui Ueyama <ruiu@google.com>2015-04-01 22:28:00 +0000
commit0d83d6129771f48cccc17cc2b5389b5359dbf30c (patch)
tree6544970d55e7c3d87b9de653fd8348f9a05fbef3 /lld/lib/ReaderWriter
parentbc0217396e619e2b162f79a4ba406db9536d0d5c (diff)
downloadbcm5719-llvm-0d83d6129771f48cccc17cc2b5389b5359dbf30c.tar.gz
bcm5719-llvm-0d83d6129771f48cccc17cc2b5389b5359dbf30c.zip
Use C++ non-static member initialization.
llvm-svn: 233859
Diffstat (limited to 'lld/lib/ReaderWriter')
-rw-r--r--lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp12
-rw-r--r--lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp5
-rw-r--r--lld/lib/ReaderWriter/ELF/Atoms.h20
-rw-r--r--lld/lib/ReaderWriter/ELF/DynamicFile.h5
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp4
-rw-r--r--lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp12
6 files changed, 24 insertions, 34 deletions
diff --git a/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp b/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
index eadeeb43848..2f0735f2ac7 100644
--- a/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
@@ -244,9 +244,7 @@ protected:
}
public:
- AArch64RelocationPass(const ELFLinkingContext &ctx)
- : _file(ctx), _ctx(ctx), _null(nullptr), _plt0(nullptr), _got0(nullptr),
- _got1(nullptr) {}
+ AArch64RelocationPass(const ELFLinkingContext &ctx) : _file(ctx), _ctx(ctx) {}
/// \brief Do the pass.
///
@@ -337,14 +335,14 @@ protected:
std::vector<ObjectAtom *> _objectVector;
/// \brief GOT entry that is always 0. Used for undefined weaks.
- GOTAtom *_null;
+ GOTAtom *_null = nullptr;
/// \brief The got and plt entries for .PLT0. This is used to call into the
/// dynamic linker for symbol resolution.
/// @{
- PLT0Atom *_plt0;
- GOTAtom *_got0;
- GOTAtom *_got1;
+ PLT0Atom *_plt0 = nullptr;
+ GOTAtom *_got0 = nullptr;
+ GOTAtom *_got1 = nullptr;
/// @}
};
diff --git a/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp
index c1b5e73dc87..86b3ec30390 100644
--- a/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp
@@ -346,8 +346,7 @@ protected:
}
public:
- ARMRelocationPass(const ELFLinkingContext &ctx)
- : _file(ctx), _ctx(ctx), _null(nullptr) {}
+ ARMRelocationPass(const ELFLinkingContext &ctx) : _file(ctx), _ctx(ctx) {}
/// \brief Do the pass.
///
@@ -433,7 +432,7 @@ protected:
std::vector<VeneerAtom *> _veneerVector;
/// \brief GOT entry that is always 0. Used for undefined weaks.
- GOTAtom *_null;
+ GOTAtom *_null = nullptr;
};
/// This implements the static relocation model. Meaning GOT and PLT entries are
diff --git a/lld/lib/ReaderWriter/ELF/Atoms.h b/lld/lib/ReaderWriter/ELF/Atoms.h
index 42f225f93e2..1dff0e3d084 100644
--- a/lld/lib/ReaderWriter/ELF/Atoms.h
+++ b/lld/lib/ReaderWriter/ELF/Atoms.h
@@ -41,19 +41,16 @@ public:
ELFReference(const Elf_Rela *rela, uint64_t off, Reference::KindArch arch,
Reference::KindValue relocType, uint32_t idx)
: Reference(Reference::KindNamespace::ELF, arch, relocType),
- _target(nullptr), _targetSymbolIndex(idx), _offsetInAtom(off),
- _addend(rela->r_addend) {}
+ _targetSymbolIndex(idx), _offsetInAtom(off), _addend(rela->r_addend) {}
ELFReference(uint64_t off, Reference::KindArch arch,
Reference::KindValue relocType, uint32_t idx)
: Reference(Reference::KindNamespace::ELF, arch, relocType),
- _target(nullptr), _targetSymbolIndex(idx), _offsetInAtom(off),
- _addend(0) {}
+ _targetSymbolIndex(idx), _offsetInAtom(off) {}
ELFReference(uint32_t edgeKind)
: Reference(Reference::KindNamespace::all, Reference::KindArch::all,
- edgeKind),
- _target(nullptr), _targetSymbolIndex(0), _offsetInAtom(0), _addend(0) {}
+ edgeKind) {}
uint64_t offsetInAtom() const override { return _offsetInAtom; }
@@ -73,10 +70,10 @@ public:
void setTarget(const Atom *newAtom) override { _target = newAtom; }
private:
- const Atom *_target;
- uint64_t _targetSymbolIndex;
- uint64_t _offsetInAtom;
- Addend _addend;
+ const Atom *_target = nullptr;
+ uint64_t _targetSymbolIndex = 0;
+ uint64_t _offsetInAtom = 0;
+ Addend _addend = 0;
};
/// \brief These atoms store symbols that are fixed to a particular address.
@@ -88,8 +85,7 @@ template <class ELFT> class ELFAbsoluteAtom : public AbsoluteAtom {
public:
ELFAbsoluteAtom(const ELFFile<ELFT> &file, StringRef name,
const Elf_Sym *symbol, uint64_t value)
- : _owningFile(file), _name(name), _symbol(symbol), _value(value) {
- }
+ : _owningFile(file), _name(name), _symbol(symbol), _value(value) {}
const ELFFile<ELFT> &file() const override { return _owningFile; }
diff --git a/lld/lib/ReaderWriter/ELF/DynamicFile.h b/lld/lib/ReaderWriter/ELF/DynamicFile.h
index c4e3e7165ef..e3e898fcd73 100644
--- a/lld/lib/ReaderWriter/ELF/DynamicFile.h
+++ b/lld/lib/ReaderWriter/ELF/DynamicFile.h
@@ -99,9 +99,8 @@ private:
StringRef _soname;
struct SymAtomPair {
- SymAtomPair() : _symbol(nullptr), _atom(nullptr) {}
- const typename llvm::object::ELFFile<ELFT>::Elf_Sym *_symbol;
- const SharedLibraryAtom *_atom;
+ const typename llvm::object::ELFFile<ELFT>::Elf_Sym *_symbol = nullptr;
+ const SharedLibraryAtom *_atom = nullptr;
};
std::unique_ptr<MemoryBuffer> _mb;
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
index 3e4e604d6b7..1788e634015 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
@@ -319,7 +319,7 @@ private:
llvm::DenseMap<const Atom *, GOTAtom *> _gotTLSGdMap;
/// \brief GOT entry for the R_xxxMIPS_TLS_LDM relocations.
- GOTTLSGdAtom<ELFT> *_gotLDMEntry;
+ GOTTLSGdAtom<ELFT> *_gotLDMEntry = nullptr;
/// \brief the list of local GOT atoms.
std::vector<GOTAtom *> _localGotVector;
@@ -411,7 +411,7 @@ private:
template <typename ELFT>
RelocationPass<ELFT>::RelocationPass(MipsLinkingContext &ctx)
- : _ctx(ctx), _file(ctx), _gotLDMEntry(nullptr) {
+ : _ctx(ctx), _file(ctx) {
_localGotVector.push_back(new (_file._alloc) GOT0Atom<ELFT>(_file));
_localGotVector.push_back(new (_file._alloc)
GOTModulePointerAtom<ELFT>(_file));
diff --git a/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp b/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
index b01036664af..0395c523a1a 100644
--- a/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
@@ -243,9 +243,7 @@ protected:
}
public:
- RelocationPass(const ELFLinkingContext &ctx)
- : _file(ctx), _ctx(ctx), _null(nullptr), _plt0(nullptr), _got0(nullptr),
- _got1(nullptr) {}
+ RelocationPass(const ELFLinkingContext &ctx) : _file(ctx), _ctx(ctx) {}
/// \brief Do the pass.
///
@@ -322,14 +320,14 @@ protected:
std::vector<GOTAtom *> _tlsGotVector;
/// \brief GOT entry that is always 0. Used for undefined weaks.
- GOTAtom *_null;
+ GOTAtom *_null = nullptr;
/// \brief The got and plt entries for .PLT0. This is used to call into the
/// dynamic linker for symbol resolution.
/// @{
- PLT0Atom *_plt0;
- GOTAtom *_got0;
- GOTAtom *_got1;
+ PLT0Atom *_plt0 = nullptr;
+ GOTAtom *_got0 = nullptr;
+ GOTAtom *_got1 = nullptr;
/// @}
};
OpenPOWER on IntegriCloud