summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp10
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJIT.h4
2 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
index 2ed267b3161..435ffd7cdfa 100644
--- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -87,10 +87,6 @@ MCJIT::~MCJIT() {
}
LoadedObjects.clear();
-
- for (object::Archive *A : Archives)
- delete A;
-
Archives.clear();
delete TM;
@@ -118,8 +114,8 @@ void MCJIT::addObjectFile(std::unique_ptr<object::ObjectFile> Obj) {
NotifyObjectEmitted(*LoadedObject);
}
-void MCJIT::addArchive(object::Archive *A) {
- Archives.push_back(A);
+void MCJIT::addArchive(std::unique_ptr<object::Archive> A) {
+ Archives.push_back(std::move(A));
}
@@ -294,7 +290,7 @@ uint64_t MCJIT::getSymbolAddress(const std::string &Name,
if (Addr)
return Addr;
- for (object::Archive *A : Archives) {
+ for (std::unique_ptr<object::Archive> &A : Archives) {
// Look for our symbols in each Archive
object::Archive::child_iterator ChildIt = A->findSym(Name);
if (ChildIt != A->child_end()) {
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
index f28aab31197..83e3321db92 100644
--- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
+++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
@@ -215,7 +215,7 @@ class MCJIT : public ExecutionEngine {
OwningModuleContainer OwnedModules;
- SmallVector<object::Archive*, 2> Archives;
+ SmallVector<std::unique_ptr<object::Archive>, 2> Archives;
typedef SmallVector<ObjectImage *, 2> LoadedObjectList;
LoadedObjectList LoadedObjects;
@@ -239,7 +239,7 @@ public:
/// @{
void addModule(Module *M) override;
void addObjectFile(std::unique_ptr<object::ObjectFile> O) override;
- void addArchive(object::Archive *O) override;
+ void addArchive(std::unique_ptr<object::Archive> O) override;
bool removeModule(Module *M) override;
/// FindFunctionNamed - Search all of the active modules to find the one that
OpenPOWER on IntegriCloud