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
This commit is contained in:
David Blaikie 2015-05-22 00:05:05 +00:00
parent a89d43a2ce
commit fcf7993d4a
2 changed files with 5 additions and 7 deletions

View File

@ -22,6 +22,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/DataTypes.h"
#include <string>
#include <memory>
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<LoadedObjectInfo> clone() const = 0;
};
}

View File

@ -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 <memory>
@ -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<const Derived &>(*this));
std::unique_ptr<llvm::LoadedObjectInfo> clone() const override {
return llvm::make_unique<Derived>(static_cast<const Derived &>(*this));
}
};