aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2014-12-03 00:51:19 +0000
committerLang Hames <lhames@gmail.com>2014-12-03 00:51:19 +0000
commit4a5697e659a29cf258708097d65a9882b2598958 (patch)
tree654dc24e6461f496f465d7e15a150a9d24cdf1a1 /llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
parent01fa7701e6ddaba68ed9e093c9cb637138cc2698 (diff)
downloadllvm-4a5697e659a29cf258708097d65a9882b2598958.zip
llvm-4a5697e659a29cf258708097d65a9882b2598958.tar.gz
llvm-4a5697e659a29cf258708097d65a9882b2598958.tar.bz2
[MCJIT] Unique-ptrify the RTDyldMemoryManager member of MCJIT. NFC.
llvm-svn: 223183
Diffstat (limited to 'llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
index 58cf4e5..f2d53f5 100644
--- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -45,21 +45,24 @@ extern "C" void LLVMLinkInMCJIT() {
ExecutionEngine *MCJIT::createJIT(std::unique_ptr<Module> M,
std::string *ErrorStr,
- RTDyldMemoryManager *MemMgr,
+ std::unique_ptr<RTDyldMemoryManager> MemMgr,
std::unique_ptr<TargetMachine> TM) {
// Try to register the program as a source of symbols to resolve against.
//
// FIXME: Don't do this here.
sys::DynamicLibrary::LoadLibraryPermanently(nullptr, nullptr);
- return new MCJIT(std::move(M), std::move(TM),
- MemMgr ? MemMgr : new SectionMemoryManager());
+ std::unique_ptr<RTDyldMemoryManager> MM = std::move(MemMgr);
+ if (!MM)
+ MM = std::unique_ptr<SectionMemoryManager>(new SectionMemoryManager());
+
+ return new MCJIT(std::move(M), std::move(TM), std::move(MM));
}
MCJIT::MCJIT(std::unique_ptr<Module> M, std::unique_ptr<TargetMachine> tm,
- RTDyldMemoryManager *MM)
+ std::unique_ptr<RTDyldMemoryManager> MM)
: ExecutionEngine(std::move(M)), TM(std::move(tm)), Ctx(nullptr),
- MemMgr(this, MM), Dyld(&MemMgr), ObjCache(nullptr) {
+ MemMgr(this, std::move(MM)), Dyld(&MemMgr), ObjCache(nullptr) {
// FIXME: We are managing our modules, so we do not want the base class
// ExecutionEngine to manage them as well. To avoid double destruction
// of the first (and only) module added in ExecutionEngine constructor