[Orc] Lambda needs to capture 'this'.
[oota-llvm.git] / include / llvm / ExecutionEngine / Orc / IRCompileLayer.h
index 873deb67376c2205de7825599b3ac1338a367de7..637902200786e914b22d2013be40431e290bef83 100644 (file)
@@ -21,6 +21,7 @@
 #include <memory>
 
 namespace llvm {
+namespace orc {
 
 /// @brief Eager IR compiling layer.
 ///
@@ -51,14 +52,16 @@ public:
   /// @brief Set an ObjectCache to query before compiling.
   void setObjectCache(ObjectCache *NewCache) { ObjCache = NewCache; }
 
-  /// @brief Compile each module in the given module set, then then add the
-  ///        resulting set of objects to the base layer, along with the memory
-  //         manager MM.
+  /// @brief Compile each module in the given module set, then add the resulting
+  ///        set of objects to the base layer along with the memory manager and
+  ///        symbol resolver.
   ///
   /// @return A handle for the added modules.
-  template <typename ModuleSetT>
+  template <typename ModuleSetT, typename MemoryManagerPtrT,
+            typename SymbolResolverPtrT>
   ModuleSetHandleT addModuleSet(ModuleSetT Ms,
-                                std::unique_ptr<RTDyldMemoryManager> MM) {
+                                MemoryManagerPtrT MemMgr,
+                                SymbolResolverPtrT Resolver) {
     OwningObjectVec Objects;
     OwningBufferVec Buffers;
 
@@ -80,7 +83,7 @@ public:
     }
 
     ModuleSetHandleT H =
-      BaseLayer.addObjectSet(Objects, std::move(MM));
+      BaseLayer.addObjectSet(Objects, std::move(MemMgr), std::move(Resolver));
 
     BaseLayer.takeOwnershipOfBuffers(H, std::move(Buffers));
 
@@ -111,6 +114,13 @@ public:
     return BaseLayer.findSymbolIn(H, Name, ExportedSymbolsOnly);
   }
 
+  /// @brief Immediately emit and finalize the moduleOB set represented by the
+  ///        given handle.
+  /// @param H Handle for module set to emit/finalize.
+  void emitAndFinalize(ModuleSetHandleT H) {
+    BaseLayer.emitAndFinalize(H);
+  }
+
 private:
   object::OwningBinary<object::ObjectFile>
   tryToLoadFromObjectCache(const Module &M) {
@@ -131,6 +141,8 @@ private:
   CompileFtor Compile;
   ObjectCache *ObjCache;
 };
-}
+
+} // End namespace orc.
+} // End namespace llvm.
 
 #endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILINGLAYER_H