diff options
| author | Lang Hames <lhames@gmail.com> | 2017-10-10 16:28:07 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2017-10-10 16:28:07 +0000 |
| commit | 60fbc7cc38cde63adac7b70391e46141270817ad (patch) | |
| tree | 75a5fa4eda963e134c27c8b7f277402e74c86ad5 /llvm/lib/Target/SystemZ | |
| parent | 37af00e7d0febf397472c40c3b0df5e6ded7688c (diff) | |
| download | bcm5719-llvm-60fbc7cc38cde63adac7b70391e46141270817ad.tar.gz bcm5719-llvm-60fbc7cc38cde63adac7b70391e46141270817ad.zip | |
[MC] Thread unique_ptr<MCObjectWriter> through the create.*ObjectWriter
functions.
This makes the ownership of the resulting MCObjectWriter clear, and allows us
to remove one instance of MCObjectStreamer's bizarre "holding ownership via
someone else's reference" trick.
llvm-svn: 315327
Diffstat (limited to 'llvm/lib/Target/SystemZ')
3 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp index 51ac410a9c8..e035c3b87a4 100644 --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp @@ -66,7 +66,8 @@ public: llvm_unreachable("SystemZ does do not have assembler relaxation"); } bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override; - MCObjectWriter *createObjectWriter(raw_pwrite_stream &OS) const override { + std::unique_ptr<MCObjectWriter> + createObjectWriter(raw_pwrite_stream &OS) const override { return createSystemZObjectWriter(OS, OSABI); } }; diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp index 166a3f0e1aa..238926d6c8e 100644 --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp @@ -13,6 +13,7 @@ #include "llvm/MC/MCELFObjectWriter.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCFixup.h" +#include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCValue.h" #include "llvm/Support/ErrorHandling.h" #include <cassert> @@ -160,8 +161,8 @@ unsigned SystemZObjectWriter::getRelocType(MCContext &Ctx, } } -MCObjectWriter *llvm::createSystemZObjectWriter(raw_pwrite_stream &OS, - uint8_t OSABI) { +std::unique_ptr<MCObjectWriter> +llvm::createSystemZObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI) { return createELFObjectWriter(llvm::make_unique<SystemZObjectWriter>(OSABI), OS, /*IsLittleEndian=*/false); } diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h index dbca3485290..99b157e3727 100644 --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h @@ -12,6 +12,8 @@ #include "llvm/Support/DataTypes.h" +#include <memory> + namespace llvm { class MCAsmBackend; @@ -91,7 +93,8 @@ MCAsmBackend *createSystemZMCAsmBackend(const Target &T, const Triple &TT, StringRef CPU, const MCTargetOptions &Options); -MCObjectWriter *createSystemZObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI); +std::unique_ptr<MCObjectWriter> createSystemZObjectWriter(raw_pwrite_stream &OS, + uint8_t OSABI); } // end namespace llvm // Defines symbolic names for SystemZ registers. |

