mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
[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
This commit is contained in:
parent
b77944d5ff
commit
4e510c10b5
@ -74,9 +74,10 @@ static bool translateInstruction(MCInst &target,
|
||||
InternalInstruction &source,
|
||||
const MCDisassembler *Dis);
|
||||
|
||||
X86GenericDisassembler::X86GenericDisassembler(const MCSubtargetInfo &STI,
|
||||
const MCInstrInfo *MII)
|
||||
: MCDisassembler(STI), MII(MII) {
|
||||
X86GenericDisassembler::X86GenericDisassembler(
|
||||
const MCSubtargetInfo &STI,
|
||||
std::unique_ptr<const MCInstrInfo> MII)
|
||||
: MCDisassembler(STI), MII(std::move(MII)) {
|
||||
switch (STI.getFeatureBits() &
|
||||
(X86::Mode16Bit | X86::Mode32Bit | X86::Mode64Bit)) {
|
||||
case X86::Mode16Bit:
|
||||
@ -93,10 +94,6 @@ X86GenericDisassembler::X86GenericDisassembler(const MCSubtargetInfo &STI,
|
||||
}
|
||||
}
|
||||
|
||||
X86GenericDisassembler::~X86GenericDisassembler() {
|
||||
delete MII;
|
||||
}
|
||||
|
||||
/// regionReader - a callback function that wraps the readByte method from
|
||||
/// MemoryObject.
|
||||
///
|
||||
@ -147,7 +144,7 @@ X86GenericDisassembler::getInstruction(MCInst &instr,
|
||||
(const void*)®ion,
|
||||
loggerFn,
|
||||
(void*)&vStream,
|
||||
(const void*)MII,
|
||||
(const void*)MII.get(),
|
||||
address,
|
||||
fMode);
|
||||
|
||||
@ -804,8 +801,8 @@ static bool translateInstruction(MCInst &mcInst,
|
||||
|
||||
static MCDisassembler *createX86Disassembler(const Target &T,
|
||||
const MCSubtargetInfo &STI) {
|
||||
return new X86Disassembler::X86GenericDisassembler(STI,
|
||||
T.createMCInstrInfo());
|
||||
std::unique_ptr<const MCInstrInfo> MII(T.createMCInstrInfo());
|
||||
return new X86Disassembler::X86GenericDisassembler(STI, std::move(MII));
|
||||
}
|
||||
|
||||
extern "C" void LLVMInitializeX86Disassembler() {
|
||||
|
@ -101,13 +101,12 @@ namespace X86Disassembler {
|
||||
/// All each platform class should have to do is subclass the constructor, and
|
||||
/// provide a different disassemblerMode value.
|
||||
class X86GenericDisassembler : public MCDisassembler {
|
||||
const MCInstrInfo *MII;
|
||||
std::unique_ptr<const MCInstrInfo> MII;
|
||||
public:
|
||||
/// Constructor - Initializes the disassembler.
|
||||
///
|
||||
X86GenericDisassembler(const MCSubtargetInfo &STI, const MCInstrInfo *MII);
|
||||
private:
|
||||
~X86GenericDisassembler();
|
||||
X86GenericDisassembler(const MCSubtargetInfo &STI,
|
||||
std::unique_ptr<const MCInstrInfo> MII);
|
||||
public:
|
||||
|
||||
/// getInstruction - See MCDisassembler.
|
||||
|
Loading…
Reference in New Issue
Block a user