[Orc] Fix a bug in the CompileOnDemand layer where stub decls were not cloned
[oota-llvm.git] / include / llvm / ExecutionEngine / RuntimeDyld.h
index ac0151aa7ec1ee506312df304616bf0545958685..94c4038e81835487e2f40d87ce23127ec598270a 100644 (file)
@@ -15,6 +15,7 @@
 #define LLVM_EXECUTIONENGINE_RUNTIMEDYLD_H
 
 #include "JITSymbolFlags.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Memory.h"
 #include "llvm/DebugInfo/DIContext.h"
@@ -62,8 +63,6 @@ public:
                      unsigned EndIdx)
       : RTDyld(RTDyld), BeginIdx(BeginIdx), EndIdx(EndIdx) { }
 
-    virtual ~LoadedObjectInfo() = default;
-
     virtual object::OwningBinary<object::ObjectFile>
     getObjectForDebug(const object::ObjectFile &Obj) const = 0;
 
@@ -80,8 +79,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));
     }
   };