diff options
| author | Lang Hames <lhames@gmail.com> | 2017-10-10 01:15:10 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2017-10-10 01:15:10 +0000 |
| commit | 1301a878f133e95e0a70264d17182ffe62cecca3 (patch) | |
| tree | 8761802eef19e595246b213aae4e4c15e09fea12 /llvm/lib/MC/WasmObjectWriter.cpp | |
| parent | ab23dace567394515566c13d44dc85acc249651a (diff) | |
| download | bcm5719-llvm-1301a878f133e95e0a70264d17182ffe62cecca3.tar.gz bcm5719-llvm-1301a878f133e95e0a70264d17182ffe62cecca3.zip | |
[MC] Plumb unique_ptr<MCWasmObjectTargetWriter> through createWasmObjectWriter
to WasmObjectWriter's constructor.
Fixes the same ownership issue for COFF that r315245 did for MachO:
WasmObjectWriter takes ownership of its MCWasmObjectTargetWriter, so we want to
pass this through to the constructor via a unique_ptr, rather than a raw ptr.
llvm-svn: 315260
Diffstat (limited to 'llvm/lib/MC/WasmObjectWriter.cpp')
| -rw-r--r-- | llvm/lib/MC/WasmObjectWriter.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp index af5c1a759c7..02d8bfbe1de 100644 --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -227,8 +227,10 @@ class WasmObjectWriter : public MCObjectWriter { void endSection(SectionBookkeeping &Section); public: - WasmObjectWriter(MCWasmObjectTargetWriter *MOTW, raw_pwrite_stream &OS) - : MCObjectWriter(OS, /*IsLittleEndian=*/true), TargetObjectWriter(MOTW) {} + WasmObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW, + raw_pwrite_stream &OS) + : MCObjectWriter(OS, /*IsLittleEndian=*/true), + TargetObjectWriter(std::move(MOTW)) {} private: ~WasmObjectWriter() override; @@ -1315,7 +1317,8 @@ void WasmObjectWriter::writeObject(MCAssembler &Asm, // TODO: Translate debug sections to the output. } -MCObjectWriter *llvm::createWasmObjectWriter(MCWasmObjectTargetWriter *MOTW, - raw_pwrite_stream &OS) { - return new WasmObjectWriter(MOTW, OS); +MCObjectWriter * +llvm::createWasmObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW, + raw_pwrite_stream &OS) { + return new WasmObjectWriter(std::move(MOTW), OS); } |

