[Mips] Make MipsELFObjectReader and MipsELFDSOReader class templates

No functional changes.

llvm-svn: 227051
This commit is contained in:
Simon Atanasyan 2015-01-25 16:38:16 +00:00
parent 4685c839d4
commit 6acffa459b
2 changed files with 10 additions and 10 deletions

View File

@ -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 &registry,
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 &registry,
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);

View File

@ -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 {