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

llvm-svn: 317498
This commit is contained in:
Mitch Phillips 2017-11-06 18:56:36 +00:00
parent 4d3f3c7206
commit 5ebf7a87f3
1 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,7 @@
#include "llvm/MC/SubtargetFeature.h" #include "llvm/MC/SubtargetFeature.h"
#include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCContext.h" #include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
@ -84,7 +85,7 @@ class LLVMFuzzerInputBuffer : public MemoryBuffer
{ {
public: public:
LLVMFuzzerInputBuffer(const uint8_t *data_, size_t size_) LLVMFuzzerInputBuffer(const uint8_t *data_, size_t size_)
: Data(reinterpret_cast<const char *>(data_)), : Data(reinterpret_cast<const char *>(data_)),
Size(size_) { Size(size_) {
init(Data, Data+Size, false); 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, MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU,
MCOptions); MCOptions);
Str.reset(TheTarget->createMCObjectStreamer( Str.reset(TheTarget->createMCObjectStreamer(
TheTriple, Ctx, *MAB, *OS, CE, *STI, MCOptions.MCRelaxAll, TheTriple, Ctx, std::unique_ptr<MCAsmBackend>(MAB), *OS,
std::unique_ptr<MCCodeEmitter>(CE), *STI, MCOptions.MCRelaxAll,
MCOptions.MCIncrementalLinkerCompatible, MCOptions.MCIncrementalLinkerCompatible,
/*DWARFMustBeAtTheEnd*/ false)); /*DWARFMustBeAtTheEnd*/ false));
} }