summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCDisassembler/Disassembler.h
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-04-06 18:21:09 +0000
committerSean Callanan <scallanan@apple.com>2012-04-06 18:21:09 +0000
commite804b5b76283725b8f0bb0eb12a5ea0ab645b2c9 (patch)
tree752b3dc08c9399ea13b560a94b764d02749c68b8 /llvm/lib/MC/MCDisassembler/Disassembler.h
parent76cc43a2a471f921efc3db52d0a5134f75fe6190 (diff)
downloadbcm5719-llvm-e804b5b76283725b8f0bb0eb12a5ea0ab645b2c9.tar.gz
bcm5719-llvm-e804b5b76283725b8f0bb0eb12a5ea0ab645b2c9.zip
Fixed two leaks in the MC disassembler. The MC
disassembler requires a MCSubtargetInfo and a MCInstrInfo to exist in order to initialize the instruction printer and disassembler; however, although the printer and disassembler keep references to these objects they do not own them. Previously, the MCSubtargetInfo and MCInstrInfo objects were just leaked. I have extended LLVMDisasmContext to own these objects and delete them when it is destroyed. llvm-svn: 154192
Diffstat (limited to 'llvm/lib/MC/MCDisassembler/Disassembler.h')
-rw-r--r--llvm/lib/MC/MCDisassembler/Disassembler.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCDisassembler/Disassembler.h b/llvm/lib/MC/MCDisassembler/Disassembler.h
index 238ff7d5002..880a31ad76b 100644
--- a/llvm/lib/MC/MCDisassembler/Disassembler.h
+++ b/llvm/lib/MC/MCDisassembler/Disassembler.h
@@ -28,7 +28,9 @@ class MCContext;
class MCAsmInfo;
class MCDisassembler;
class MCInstPrinter;
+class MCInstrInfo;
class MCRegisterInfo;
+class MCSubtargetInfo;
class Target;
//
@@ -61,6 +63,10 @@ private:
llvm::OwningPtr<const llvm::MCAsmInfo> MAI;
// The register information for the target architecture.
llvm::OwningPtr<const llvm::MCRegisterInfo> MRI;
+ // The subtarget information for the target architecture.
+ llvm::OwningPtr<const llvm::MCSubtargetInfo> MSI;
+ // The instruction information for the target architecture.
+ llvm::OwningPtr<const llvm::MCInstrInfo> MII;
// The assembly context for creating symbols and MCExprs.
llvm::OwningPtr<const llvm::MCContext> Ctx;
// The disassembler for the target architecture.
@@ -78,6 +84,8 @@ public:
LLVMSymbolLookupCallback symbolLookUp,
const Target *theTarget, const MCAsmInfo *mAI,
const MCRegisterInfo *mRI,
+ const MCSubtargetInfo *mSI,
+ const MCInstrInfo *mII,
llvm::MCContext *ctx, const MCDisassembler *disAsm,
MCInstPrinter *iP) : TripleName(tripleName),
DisInfo(disInfo), TagType(tagType), GetOpInfo(getOpInfo),
@@ -85,6 +93,8 @@ public:
CommentStream(CommentsToEmit) {
MAI.reset(mAI);
MRI.reset(mRI);
+ MSI.reset(mSI);
+ MII.reset(mII);
Ctx.reset(ctx);
DisAsm.reset(disAsm);
IP.reset(iP);
OpenPOWER on IntegriCloud