[MCJIT] Unique-ptrify the RTDyldMemoryManager member of MCJIT. NFC.
[oota-llvm.git] / include / llvm / ExecutionEngine / ExecutionEngine.h
index 36b885d288d28591091b5b74090066f595f47a4e..d79bd3c4dfc876a443b56a09ab901ff3e35bed13 100644 (file)
@@ -41,7 +41,6 @@ class Function;
 class GlobalVariable;
 class GlobalValue;
 class JITEventListener;
-class JITMemoryManager;
 class MachineCodeInfo;
 class MutexGuard;
 class ObjectCache;
@@ -139,10 +138,11 @@ protected:
   /// getMemoryforGV - Allocate memory for a global variable.
   virtual char *getMemoryForGV(const GlobalVariable *GV);
 
-  static ExecutionEngine *(*MCJITCtor)(std::unique_ptr<Module> M,
-                                       std::string *ErrorStr,
-                                       RTDyldMemoryManager *MCJMM,
-                                       std::unique_ptr<TargetMachine> TM);
+  static ExecutionEngine *(*MCJITCtor)(
+                                     std::unique_ptr<Module> M,
+                                     std::string *ErrorStr,
+                                     std::unique_ptr<RTDyldMemoryManager> MCJMM,
+                                     std::unique_ptr<TargetMachine> TM);
   static ExecutionEngine *(*InterpCtor)(std::unique_ptr<Module> M,
                                         std::string *ErrorStr);
 
@@ -493,7 +493,7 @@ private:
   EngineKind::Kind WhichEngine;
   std::string *ErrorStr;
   CodeGenOpt::Level OptLevel;
-  RTDyldMemoryManager *MCJMM;
+  std::unique_ptr<RTDyldMemoryManager> MCJMM;
   TargetOptions Options;
   Reloc::Model RelocModel;
   CodeModel::Model CMModel;
@@ -507,9 +507,10 @@ private:
 
 public:
   /// Constructor for EngineBuilder.
-  EngineBuilder(std::unique_ptr<Module> M) : M(std::move(M)) {
-    InitEngine();
-  }
+  EngineBuilder(std::unique_ptr<Module> M);
+
+  // Out-of-line since we don't have the def'n of RTDyldMemoryManager here.
+  ~EngineBuilder();
 
   /// setEngineKind - Controls whether the user wants the interpreter, the JIT,
   /// or whichever engine works.  This option defaults to EngineKind::Either.
@@ -523,12 +524,8 @@ public:
   /// is only appropriate for the MCJIT; setting this and configuring the builder
   /// to create anything other than MCJIT will cause a runtime error. If create()
   /// is called and is successful, the created engine takes ownership of the
-  /// memory manager. This option defaults to NULL. Using this option nullifies
-  /// the setJITMemoryManager() option.
-  EngineBuilder &setMCJITMemoryManager(RTDyldMemoryManager *mcjmm) {
-    MCJMM = mcjmm;
-    return *this;
-  }
+  /// memory manager. This option defaults to NULL.
+  EngineBuilder &setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager> mcjmm);
 
   /// setErrorStr - Set the error string to write to on error.  This option
   /// defaults to NULL.