[lld] r227051 - [Mips] Make MipsELFObjectReader and MipsELFDSOReader class templates
Simon Atanasyan
simon at atanasyan.com
Sun Jan 25 08:38:16 PST 2015
Author: atanasyan
Date: Sun Jan 25 10:38:16 2015
New Revision: 227051
URL: http://llvm.org/viewvc/llvm-project?rev=227051&view=rev
Log:
[Mips] Make MipsELFObjectReader and MipsELFDSOReader class templates
No functional changes.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h?rev=227051&r1=227050&r2=227051&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h Sun Jan 25 10:38:16 2015
@@ -37,10 +37,10 @@ struct MipsDynamicFileCreateELFTraits {
}
};
+template <class ELFT>
class MipsELFObjectReader
- : public ELFObjectReader<Mips32ElELFType, MipsELFFileCreateTraits> {
- typedef ELFObjectReader<Mips32ElELFType, MipsELFFileCreateTraits>
- BaseReaderType;
+ : public ELFObjectReader<ELFT, MipsELFFileCreateTraits> {
+ typedef ELFObjectReader<ELFT, MipsELFFileCreateTraits> BaseReaderType;
public:
MipsELFObjectReader(MipsLinkingContext &ctx, bool atomizeStrings)
@@ -50,7 +50,7 @@ public:
std::error_code
loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,
std::vector<std::unique_ptr<File>> &result) const override {
- auto &hdr = *elfHeader(*mb);
+ auto &hdr = *this->elfHeader(*mb);
if (std::error_code ec = _flagMerger.merge(hdr.getFileClass(), hdr.e_flags))
return ec;
return BaseReaderType::loadFile(std::move(mb), registry, result);
@@ -60,10 +60,10 @@ private:
MipsELFFlagsMerger &_flagMerger;
};
+template <class ELFT>
class MipsELFDSOReader
- : public ELFDSOReader<Mips32ElELFType, MipsDynamicFileCreateELFTraits> {
- typedef ELFDSOReader<Mips32ElELFType, MipsDynamicFileCreateELFTraits>
- BaseReaderType;
+ : public ELFDSOReader<ELFT, MipsDynamicFileCreateELFTraits> {
+ typedef ELFDSOReader<ELFT, MipsDynamicFileCreateELFTraits> BaseReaderType;
public:
MipsELFDSOReader(MipsLinkingContext &ctx, bool useUndefines)
@@ -73,7 +73,7 @@ public:
std::error_code
loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,
std::vector<std::unique_ptr<File>> &result) const override {
- auto &hdr = *elfHeader(*mb);
+ auto &hdr = *this->elfHeader(*mb);
if (std::error_code ec = _flagMerger.merge(hdr.getFileClass(), hdr.e_flags))
return ec;
return BaseReaderType::loadFile(std::move(mb), registry, result);
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h?rev=227051&r1=227050&r2=227051&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h Sun Jan 25 10:38:16 2015
@@ -92,12 +92,12 @@ public:
std::unique_ptr<Reader> getObjReader(bool atomizeStrings) override {
return std::unique_ptr<Reader>(
- new MipsELFObjectReader(_ctx, atomizeStrings));
+ new MipsELFObjectReader<Mips32ElELFType>(_ctx, atomizeStrings));
}
std::unique_ptr<Reader> getDSOReader(bool useShlibUndefines) override {
return std::unique_ptr<Reader>(
- new MipsELFDSOReader(_ctx, useShlibUndefines));
+ new MipsELFDSOReader<Mips32ElELFType>(_ctx, useShlibUndefines));
}
const MipsTargetRelocationHandler &getRelocationHandler() const override {
More information about the llvm-commits
mailing list