Skip to content

Commit

Permalink
[llvm-objcopy] [COFF] Remove pointless Reader/Writer base classes. NFC.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mstorsjo committed Jan 12, 2019
1 parent 90fe6ed commit 6a4d2d6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
2 changes: 0 additions & 2 deletions llvm/tools/llvm-objcopy/COFF/Reader.cpp
Expand Up @@ -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();
Expand Down
10 changes: 2 additions & 8 deletions llvm/tools/llvm-objcopy/COFF/Reader.h
Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions llvm/tools/llvm-objcopy/COFF/Writer.cpp
Expand Up @@ -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) {
Expand Down
15 changes: 3 additions & 12 deletions llvm/tools/llvm-objcopy/COFF/Writer.h
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 6a4d2d6

Please sign in to comment.