70
70
#include " llvm/MC/MCCodeEmitter.h"
71
71
#include " llvm/MC/MCContext.h"
72
72
#include " llvm/MC/MCInstrInfo.h"
73
+ #include " llvm/MC/MCInstPrinter.h"
73
74
#include " llvm/MC/MCObjectFileInfo.h"
74
75
#include " llvm/MC/MCObjectWriter.h"
75
76
#include " llvm/MC/MCParser/MCAsmParser.h"
@@ -462,8 +463,9 @@ bool executeAssemblerImpl(AssemblerInvocation &Opts, DiagnosticsEngine &Diags,
462
463
463
464
// FIXME: There is a bit of code duplication with addPassesToEmitFile.
464
465
if (Opts.OutputType == AssemblerInvocation::FT_Asm) {
465
- MCInstPrinter *IP = TheTarget->createMCInstPrinter (
466
- llvm::Triple (Opts.Triple ), Opts.OutputAsmVariant , *MAI, *MCII, *MRI);
466
+ std::unique_ptr<MCInstPrinter> InstructionPrinter (
467
+ TheTarget->createMCInstPrinter (
468
+ llvm::Triple (Opts.Triple ), Opts.OutputAsmVariant , *MAI, *MCII, *MRI));
467
469
std::unique_ptr<MCCodeEmitter> MCE;
468
470
std::unique_ptr<MCAsmBackend> MAB;
469
471
if (Opts.ShowEncoding ) {
@@ -472,7 +474,7 @@ bool executeAssemblerImpl(AssemblerInvocation &Opts, DiagnosticsEngine &Diags,
472
474
MAB.reset (TheTarget->createMCAsmBackend (*STI, *MRI, Options));
473
475
}
474
476
auto FOut = std::make_unique<formatted_raw_ostream>(*Out);
475
- Str.reset (TheTarget->createAsmStreamer (Ctx, std::move (FOut), IP ,
477
+ Str.reset (TheTarget->createAsmStreamer (Ctx, std::move (FOut), std::move (InstructionPrinter) ,
476
478
std::move (MCE), std::move (MAB)));
477
479
} else if (Opts.OutputType == AssemblerInvocation::FT_Null) {
478
480
Str.reset (createNullStreamer (Ctx));
0 commit comments