From: David Blaikie Date: Fri, 22 May 2015 00:05:05 +0000 (+0000) Subject: unique_ptrify LoadedObjectInfo::clone X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=fcf7993d4a3956b74e9a5d70c1292dbce66bef01 unique_ptrify LoadedObjectInfo::clone As noted in the original review, this is unused in tree & is used by Julia... that's problematic. This API coudl easily be deleted/modified by accident without any validation that it remains correct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237976 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/DebugInfo/DIContext.h b/include/llvm/DebugInfo/DIContext.h index d8830da56b5..da1b5e985d8 100644 --- a/include/llvm/DebugInfo/DIContext.h +++ b/include/llvm/DebugInfo/DIContext.h @@ -22,6 +22,7 @@ #include "llvm/Support/Casting.h" #include "llvm/Support/DataTypes.h" #include +#include namespace llvm { @@ -165,11 +166,7 @@ public: virtual bool getLoadedSectionContents(StringRef Name, StringRef &Data) const { return false; } - - /// Obtain a copy of this LoadedObjectInfo. - /// - /// The caller is responsible for deallocation once the copy is no longer required. - virtual LoadedObjectInfo *clone() const = 0; + virtual std::unique_ptr clone() const = 0; }; } diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h index ac0151aa7ec..b882f133adb 100644 --- a/include/llvm/ExecutionEngine/RuntimeDyld.h +++ b/include/llvm/ExecutionEngine/RuntimeDyld.h @@ -16,6 +16,7 @@ #include "JITSymbolFlags.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/Memory.h" #include "llvm/DebugInfo/DIContext.h" #include @@ -80,8 +81,8 @@ public: LoadedObjectInfoHelper(RuntimeDyldImpl &RTDyld, unsigned BeginIdx, unsigned EndIdx) : LoadedObjectInfo(RTDyld, BeginIdx, EndIdx) {} - llvm::LoadedObjectInfo *clone() const override { - return new Derived(static_cast(*this)); + std::unique_ptr clone() const override { + return llvm::make_unique(static_cast(*this)); } };