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,
|
InternalInstruction &source,
|
||||||
const MCDisassembler *Dis);
|
const MCDisassembler *Dis);
|
||||||
|
|
||||||
X86GenericDisassembler::X86GenericDisassembler(const MCSubtargetInfo &STI,
|
X86GenericDisassembler::X86GenericDisassembler(
|
||||||
const MCInstrInfo *MII)
|
const MCSubtargetInfo &STI,
|
||||||
: MCDisassembler(STI), MII(MII) {
|
std::unique_ptr<const MCInstrInfo> MII)
|
||||||
|
: MCDisassembler(STI), MII(std::move(MII)) {
|
||||||
switch (STI.getFeatureBits() &
|
switch (STI.getFeatureBits() &
|
||||||
(X86::Mode16Bit | X86::Mode32Bit | X86::Mode64Bit)) {
|
(X86::Mode16Bit | X86::Mode32Bit | X86::Mode64Bit)) {
|
||||||
case X86::Mode16Bit:
|
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
|
/// regionReader - a callback function that wraps the readByte method from
|
||||||
/// MemoryObject.
|
/// MemoryObject.
|
||||||
///
|
///
|
||||||
@ -147,7 +144,7 @@ X86GenericDisassembler::getInstruction(MCInst &instr,
|
|||||||
(const void*)®ion,
|
(const void*)®ion,
|
||||||
loggerFn,
|
loggerFn,
|
||||||
(void*)&vStream,
|
(void*)&vStream,
|
||||||
(const void*)MII,
|
(const void*)MII.get(),
|
||||||
address,
|
address,
|
||||||
fMode);
|
fMode);
|
||||||
|
|
||||||
@ -804,8 +801,8 @@ static bool translateInstruction(MCInst &mcInst,
|
|||||||
|
|
||||||
static MCDisassembler *createX86Disassembler(const Target &T,
|
static MCDisassembler *createX86Disassembler(const Target &T,
|
||||||
const MCSubtargetInfo &STI) {
|
const MCSubtargetInfo &STI) {
|
||||||
return new X86Disassembler::X86GenericDisassembler(STI,
|
std::unique_ptr<const MCInstrInfo> MII(T.createMCInstrInfo());
|
||||||
T.createMCInstrInfo());
|
return new X86Disassembler::X86GenericDisassembler(STI, std::move(MII));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void LLVMInitializeX86Disassembler() {
|
extern "C" void LLVMInitializeX86Disassembler() {
|
||||||
|
@ -101,13 +101,12 @@ namespace X86Disassembler {
|
|||||||
/// All each platform class should have to do is subclass the constructor, and
|
/// All each platform class should have to do is subclass the constructor, and
|
||||||
/// provide a different disassemblerMode value.
|
/// provide a different disassemblerMode value.
|
||||||
class X86GenericDisassembler : public MCDisassembler {
|
class X86GenericDisassembler : public MCDisassembler {
|
||||||
const MCInstrInfo *MII;
|
std::unique_ptr<const MCInstrInfo> MII;
|
||||||
public:
|
public:
|
||||||
/// Constructor - Initializes the disassembler.
|
/// Constructor - Initializes the disassembler.
|
||||||
///
|
///
|
||||||
X86GenericDisassembler(const MCSubtargetInfo &STI, const MCInstrInfo *MII);
|
X86GenericDisassembler(const MCSubtargetInfo &STI,
|
||||||
private:
|
std::unique_ptr<const MCInstrInfo> MII);
|
||||||
~X86GenericDisassembler();
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// getInstruction - See MCDisassembler.
|
/// getInstruction - See MCDisassembler.
|
||||||
|
Loading…
Reference in New Issue
Block a user