[llvm] r217180 - unique_ptrify RuntimeDyld::Dyld

David Blaikie dblaikie at gmail.com
Thu Sep 4 11:37:30 PDT 2014


Author: dblaikie
Date: Thu Sep  4 13:37:29 2014
New Revision: 217180

URL: http://llvm.org/viewvc/llvm-project?rev=217180&view=rev
Log:
unique_ptrify RuntimeDyld::Dyld

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp

Modified: llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h?rev=217180&r1=217179&r2=217180&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h Thu Sep  4 13:37:29 2014
@@ -37,7 +37,7 @@ class RuntimeDyld {
 
   // RuntimeDyldImpl is the actual class. RuntimeDyld is just the public
   // interface.
-  RuntimeDyldImpl *Dyld;
+  std::unique_ptr<RuntimeDyldImpl> Dyld;
   RTDyldMemoryManager *MM;
   bool ProcessAllSections;
   RuntimeDyldCheckerImpl *Checker;

Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=217180&r1=217179&r2=217180&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Thu Sep  4 13:37:29 2014
@@ -778,7 +778,7 @@ RuntimeDyld::RuntimeDyld(RTDyldMemoryMan
   Checker = nullptr;
 }
 
-RuntimeDyld::~RuntimeDyld() { delete Dyld; }
+RuntimeDyld::~RuntimeDyld() {}
 
 static std::unique_ptr<RuntimeDyldELF>
 createRuntimeDyldELF(RTDyldMemoryManager *MM, bool ProcessAllSections,
@@ -807,13 +807,13 @@ RuntimeDyld::loadObject(std::unique_ptr<
   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<Triple::ArchType>(InputImage->getArch()),
-                           MM, ProcessAllSections, Checker).release();
+          static_cast<Triple::ArchType>(InputImage->getArch()), MM,
+          ProcessAllSections, Checker);
   } else
     report_fatal_error("Incompatible object format!");
 
@@ -836,7 +836,7 @@ RuntimeDyld::loadObject(std::unique_ptr<
   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<
     InputImage = RuntimeDyldMachO::createObjectImage(std::move(InputBuffer));
     if (!Dyld)
       Dyld = createRuntimeDyldMachO(
-                           static_cast<Triple::ArchType>(InputImage->getArch()),
-                           MM, ProcessAllSections, Checker).release();
+          static_cast<Triple::ArchType>(InputImage->getArch()), MM,
+          ProcessAllSections, Checker);
     break;
   case sys::fs::file_magic::unknown:
   case sys::fs::file_magic::bitcode:





More information about the llvm-commits mailing list