diff --git a/tools/edis/EDDisassembler.cpp b/tools/edis/EDDisassembler.cpp index 5a59e34f576..83505c3b9f5 100644 --- a/tools/edis/EDDisassembler.cpp +++ b/tools/edis/EDDisassembler.cpp @@ -175,11 +175,10 @@ EDDisassembler::EDDisassembler(CPUKey &key) : std::string featureString; - OwningPtr - targetMachine(Tgt->createTargetMachine(tripleString, - featureString)); + TargetMachine.reset(Tgt->createTargetMachine(tripleString, + featureString)); - const TargetRegisterInfo *registerInfo = targetMachine->getRegisterInfo(); + const TargetRegisterInfo *registerInfo = TargetMachine->getRegisterInfo(); if (!registerInfo) return; @@ -209,7 +208,7 @@ EDDisassembler::EDDisassembler(CPUKey &key) : SpecificAsmLexer.reset(Tgt->createAsmLexer(*AsmInfo)); SpecificAsmLexer->InstallLexer(*GenericAsmLexer); - initMaps(*targetMachine->getRegisterInfo()); + initMaps(*TargetMachine->getRegisterInfo()); Valid = true; } diff --git a/tools/edis/EDDisassembler.h b/tools/edis/EDDisassembler.h index 74a260e8253..913ae842bf9 100644 --- a/tools/edis/EDDisassembler.h +++ b/tools/edis/EDDisassembler.h @@ -47,6 +47,7 @@ class MCStreamer; template class SmallVectorImpl; class SourceMgr; class Target; +class TargetMachine; class TargetRegisterInfo; struct EDInstInfo; @@ -127,6 +128,8 @@ struct EDDisassembler { CPUKey Key; /// The LLVM target corresponding to the disassembler const llvm::Target *Tgt; + /// The target machien instance. + llvm::OwningPtr TargetMachine; /// The assembly information for the target architecture llvm::OwningPtr AsmInfo; /// The disassembler for the target architecture