From 91c286e4ed96dfb616fbab6a9a66f04cbd35ebf1 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 4 Sep 2014 18:37:29 +0000 Subject: [PATCH] unique_ptrify RuntimeDyld::Dyld git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217180 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ExecutionEngine/RuntimeDyld.h | 2 +- lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h index 2ca6421de66..7e6305d5615 100644 --- a/include/llvm/ExecutionEngine/RuntimeDyld.h +++ b/include/llvm/ExecutionEngine/RuntimeDyld.h @@ -37,7 +37,7 @@ class RuntimeDyld { // RuntimeDyldImpl is the actual class. RuntimeDyld is just the public // interface. - RuntimeDyldImpl *Dyld; + std::unique_ptr Dyld; RTDyldMemoryManager *MM; bool ProcessAllSections; RuntimeDyldCheckerImpl *Checker; diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 24c346f8e67..5a178763b50 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -778,7 +778,7 @@ RuntimeDyld::RuntimeDyld(RTDyldMemoryManager *mm) { Checker = nullptr; } -RuntimeDyld::~RuntimeDyld() { delete Dyld; } +RuntimeDyld::~RuntimeDyld() {} static std::unique_ptr createRuntimeDyldELF(RTDyldMemoryManager *MM, bool ProcessAllSections, @@ -807,13 +807,13 @@ RuntimeDyld::loadObject(std::unique_ptr InputObject) { if (InputObject->isELF()) { InputImage.reset(RuntimeDyldELF::createObjectImageFromFile(std::move(InputObject))); if (!Dyld) - Dyld = createRuntimeDyldELF(MM, ProcessAllSections, Checker).release(); + Dyld = createRuntimeDyldELF(MM, ProcessAllSections, Checker); } else if (InputObject->isMachO()) { InputImage.reset(RuntimeDyldMachO::createObjectImageFromFile(std::move(InputObject))); if (!Dyld) Dyld = createRuntimeDyldMachO( - static_cast(InputImage->getArch()), - MM, ProcessAllSections, Checker).release(); + static_cast(InputImage->getArch()), MM, + ProcessAllSections, Checker); } else report_fatal_error("Incompatible object format!"); @@ -836,7 +836,7 @@ RuntimeDyld::loadObject(std::unique_ptr InputBuffer) { case sys::fs::file_magic::elf_core: InputImage = RuntimeDyldELF::createObjectImage(std::move(InputBuffer)); if (!Dyld) - Dyld = createRuntimeDyldELF(MM, ProcessAllSections, Checker).release(); + Dyld = createRuntimeDyldELF(MM, ProcessAllSections, Checker); break; case sys::fs::file_magic::macho_object: case sys::fs::file_magic::macho_executable: @@ -851,8 +851,8 @@ RuntimeDyld::loadObject(std::unique_ptr InputBuffer) { InputImage = RuntimeDyldMachO::createObjectImage(std::move(InputBuffer)); if (!Dyld) Dyld = createRuntimeDyldMachO( - static_cast(InputImage->getArch()), - MM, ProcessAllSections, Checker).release(); + static_cast(InputImage->getArch()), MM, + ProcessAllSections, Checker); break; case sys::fs::file_magic::unknown: case sys::fs::file_magic::bitcode: