[llvm-objcopy] [COFF] Remove pointless Reader/Writer base classes. NFC.

These were copied as part of the original design from the ELF
backend, but aren't necessary at the moment.

Differential Revision: https://reviews.llvm.org/D56431

llvm-svn: 350996
This commit is contained in:
Martin Storsjo 2019-01-12 08:30:09 +00:00
parent 90fe6edcba
commit 6a4d2d6561
4 changed files with 5 additions and 24 deletions

View File

@ -23,8 +23,6 @@ namespace coff {
using namespace object;
Reader::~Reader() {}
Error COFFReader::readExecutableHeaders(Object &Obj) const {
const dos_header *DH = COFFObj.getDOSHeader();
Obj.Is64 = COFFObj.is64();

View File

@ -23,13 +23,7 @@ struct Object;
using object::COFFObjectFile;
class Reader {
public:
virtual ~Reader();
virtual Expected<std::unique_ptr<Object>> create() const = 0;
};
class COFFReader : public Reader {
class COFFReader {
const COFFObjectFile &COFFObj;
Error readExecutableHeaders(Object &Obj) const;
@ -39,7 +33,7 @@ class COFFReader : public Reader {
public:
explicit COFFReader(const COFFObjectFile &O) : COFFObj(O) {}
Expected<std::unique_ptr<Object>> create() const override;
Expected<std::unique_ptr<Object>> create() const;
};
} // end namespace coff

View File

@ -25,8 +25,6 @@ namespace coff {
using namespace object;
using namespace COFF;
Writer::~Writer() {}
Error COFFWriter::finalizeRelocTargets() {
for (Section &Sec : Obj.Sections) {
for (Relocation &R : Sec.Relocs) {

View File

@ -22,19 +22,10 @@ namespace coff {
struct Object;
class Writer {
protected:
class COFFWriter {
Object &Obj;
Buffer &Buf;
public:
virtual ~Writer();
virtual Error write() = 0;
Writer(Object &O, Buffer &B) : Obj(O), Buf(B) {}
};
class COFFWriter : public Writer {
size_t FileSize;
size_t FileAlignment;
size_t SizeOfInitializedData;
@ -57,10 +48,10 @@ class COFFWriter : public Writer {
public:
virtual ~COFFWriter() {}
Error write() override;
Error write();
COFFWriter(Object &Obj, Buffer &Buf)
: Writer(Obj, Buf), StrTabBuilder(StringTableBuilder::WinCOFF) {}
: Obj(Obj), Buf(Buf), StrTabBuilder(StringTableBuilder::WinCOFF) {}
};
} // end namespace coff