[PATCH] D47049: MC: Extract a derived class from ELFObjectWriter. NFCI.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 21 12:34:55 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL332870: MC: Extract a derived class from ELFObjectWriter. NFCI. (authored by pcc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D47049?vs=147429&id=147837#toc
Repository:
rL LLVM
https://reviews.llvm.org/D47049
Files:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Index: llvm/trunk/lib/MC/ELFObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp
@@ -215,9 +215,6 @@
};
class ELFObjectWriter : public MCObjectWriter {
- raw_pwrite_stream &OS;
- bool IsLittleEndian;
-
/// The target specific ELF writer instance.
std::unique_ptr<MCELFObjectTargetWriter> TargetObjectWriter;
@@ -233,10 +230,8 @@
unsigned Type) const;
public:
- ELFObjectWriter(std::unique_ptr<MCELFObjectTargetWriter> MOTW,
- raw_pwrite_stream &OS, bool IsLittleEndian)
- : OS(OS), IsLittleEndian(IsLittleEndian),
- TargetObjectWriter(std::move(MOTW)) {}
+ ELFObjectWriter(std::unique_ptr<MCELFObjectTargetWriter> MOTW)
+ : TargetObjectWriter(std::move(MOTW)) {}
void reset() override {
Relocations.clear();
@@ -253,16 +248,27 @@
const MCFragment *Fragment, const MCFixup &Fixup,
MCValue Target, uint64_t &FixedValue) override;
- uint64_t writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override {
- return ELFWriter(*this, OS, IsLittleEndian).writeObject(Asm, Layout);
- }
-
void executePostLayoutBinding(MCAssembler &Asm,
const MCAsmLayout &Layout) override;
friend struct ELFWriter;
};
+class ELFSingleObjectWriter : public ELFObjectWriter {
+ raw_pwrite_stream &OS;
+ bool IsLittleEndian;
+
+public:
+ ELFSingleObjectWriter(std::unique_ptr<MCELFObjectTargetWriter> MOTW,
+ raw_pwrite_stream &OS, bool IsLittleEndian)
+ : ELFObjectWriter(std::move(MOTW)), OS(OS),
+ IsLittleEndian(IsLittleEndian) {}
+
+ uint64_t writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override {
+ return ELFWriter(*this, OS, IsLittleEndian).writeObject(Asm, Layout);
+ }
+};
+
} // end anonymous namespace
void ELFWriter::align(unsigned Alignment) {
@@ -1374,6 +1380,6 @@
std::unique_ptr<MCObjectWriter>
llvm::createELFObjectWriter(std::unique_ptr<MCELFObjectTargetWriter> MOTW,
raw_pwrite_stream &OS, bool IsLittleEndian) {
- return llvm::make_unique<ELFObjectWriter>(std::move(MOTW), OS,
- IsLittleEndian);
+ return llvm::make_unique<ELFSingleObjectWriter>(std::move(MOTW), OS,
+ IsLittleEndian);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47049.147837.patch
Type: text/x-patch
Size: 2485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180521/91c717a3/attachment.bin>
More information about the llvm-commits
mailing list