llvm.org GIT mirror llvm / eaa6e93
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350996 91177308-0d34-0410-b5e6-96231b3b80d8 Martin Storsjo 7 months ago
4 changed file(s) with 5 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
2121 namespace coff {
2222
2323 using namespace object;
24
25 Reader::~Reader() {}
2624
2725 Error COFFReader::readExecutableHeaders(Object &Obj) const {
2826 const dos_header *DH = COFFObj.getDOSHeader();
2222
2323 using object::COFFObjectFile;
2424
25 class Reader {
26 public:
27 virtual ~Reader();
28 virtual Expected> create() const = 0;
29 };
30
31 class COFFReader : public Reader {
25 class COFFReader {
3226 const COFFObjectFile &COFFObj;
3327
3428 Error readExecutableHeaders(Object &Obj) const;
3832
3933 public:
4034 explicit COFFReader(const COFFObjectFile &O) : COFFObj(O) {}
41 Expected> create() const override;
35 Expected> create() const;
4236 };
4337
4438 } // end namespace coff
2323
2424 using namespace object;
2525 using namespace COFF;
26
27 Writer::~Writer() {}
2826
2927 Error COFFWriter::finalizeRelocTargets() {
3028 for (Section &Sec : Obj.Sections) {
2121
2222 struct Object;
2323
24 class Writer {
25 protected:
24 class COFFWriter {
2625 Object &Obj;
2726 Buffer &Buf;
2827
29 public:
30 virtual ~Writer();
31 virtual Error write() = 0;
32
33 Writer(Object &O, Buffer &B) : Obj(O), Buf(B) {}
34 };
35
36 class COFFWriter : public Writer {
3728 size_t FileSize;
3829 size_t FileAlignment;
3930 size_t SizeOfInitializedData;
5647
5748 public:
5849 virtual ~COFFWriter() {}
59 Error write() override;
50 Error write();
6051
6152 COFFWriter(Object &Obj, Buffer &Buf)
62 : Writer(Obj, Buf), StrTabBuilder(StringTableBuilder::WinCOFF) {}
53 : Obj(Obj), Buf(Buf), StrTabBuilder(StringTableBuilder::WinCOFF) {}
6354 };
6455
6556 } // end namespace coff