llvm.org GIT mirror llvm / 4e510c1
[X86] unique_ptr'ify one of X86GenericDisassembler's members. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206127 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 6 years ago
2 changed file(s) with 10 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
7373 InternalInstruction &source,
7474 const MCDisassembler *Dis);
7575
76 X86GenericDisassembler::X86GenericDisassembler(const MCSubtargetInfo &STI,
77 const MCInstrInfo *MII)
78 : MCDisassembler(STI), MII(MII) {
76 X86GenericDisassembler::X86GenericDisassembler(
77 const MCSubtargetInfo &STI,
78 std::unique_ptr MII)
79 : MCDisassembler(STI), MII(std::move(MII)) {
7980 switch (STI.getFeatureBits() &
8081 (X86::Mode16Bit | X86::Mode32Bit | X86::Mode64Bit)) {
8182 case X86::Mode16Bit:
9293 }
9394 }
9495
95 X86GenericDisassembler::~X86GenericDisassembler() {
96 delete MII;
97 }
98
9996 /// regionReader - a callback function that wraps the readByte method from
10097 /// MemoryObject.
10198 ///
146143 (const void*)®ion,
147144 loggerFn,
148145 (void*)&vStream,
149 (const void*)MII,
146 (const void*)MII.get(),
150147 address,
151148 fMode);
152149
803800
804801 static MCDisassembler *createX86Disassembler(const Target &T,
805802 const MCSubtargetInfo &STI) {
806 return new X86Disassembler::X86GenericDisassembler(STI,
807 T.createMCInstrInfo());
803 std::unique_ptr MII(T.createMCInstrInfo());
804 return new X86Disassembler::X86GenericDisassembler(STI, std::move(MII));
808805 }
809806
810807 extern "C" void LLVMInitializeX86Disassembler() {
100100 /// All each platform class should have to do is subclass the constructor, and
101101 /// provide a different disassemblerMode value.
102102 class X86GenericDisassembler : public MCDisassembler {
103 const MCInstrInfo *MII;
103 std::unique_ptr MII;
104104 public:
105105 /// Constructor - Initializes the disassembler.
106106 ///
107 X86GenericDisassembler(const MCSubtargetInfo &STI, const MCInstrInfo *MII);
108 private:
109 ~X86GenericDisassembler();
107 X86GenericDisassembler(const MCSubtargetInfo &STI,
108 std::unique_ptr MII);
110109 public:
111110
112111 /// getInstruction - See MCDisassembler.