From 6e029979011433fef0a7cc11b7acc9e864affb87 Mon Sep 17 00:00:00 2001 From: Mitch Phillips Date: Mon, 6 Nov 2017 18:56:36 +0000 Subject: [PATCH] Make MCAsmBackend and MCCodeEmiiter passed by unique_ptr rval Summary: Fixes build breakage of llvm-mc-assemble-fuzzer introduced by rL315531. Reviewers: lhames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39268 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317498 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp b/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp index 5a0d6ac4f47..96dbc245ed9 100644 --- a/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp +++ b/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp @@ -13,6 +13,7 @@ #include "llvm/MC/SubtargetFeature.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCInstrInfo.h" @@ -84,7 +85,7 @@ class LLVMFuzzerInputBuffer : public MemoryBuffer { public: LLVMFuzzerInputBuffer(const uint8_t *data_, size_t size_) - : Data(reinterpret_cast(data_)), + : Data(reinterpret_cast(data_)), Size(size_) { init(Data, Data+Size, false); } @@ -230,7 +231,8 @@ int AssembleOneInput(const uint8_t *Data, size_t Size) { MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU, MCOptions); Str.reset(TheTarget->createMCObjectStreamer( - TheTriple, Ctx, *MAB, *OS, CE, *STI, MCOptions.MCRelaxAll, + TheTriple, Ctx, std::unique_ptr(MAB), *OS, + std::unique_ptr(CE), *STI, MCOptions.MCRelaxAll, MCOptions.MCIncrementalLinkerCompatible, /*DWARFMustBeAtTheEnd*/ false)); } -- 2.40.0