X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FExecutionEngine%2FOrc%2FObjectLinkingLayer.h;h=03b43aa3272d429369244148864a2b0c6bad202e;hp=a1d6c48ecd0e0fc52238283b1ab1bb01c9e99f55;hb=a73abdb6809f4565b42bf66525200b0ea3cf332a;hpb=63cc4f56a92d80148009381616897c7a1836c296 diff --git a/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h b/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h index a1d6c48ecd0..03b43aa3272 100644 --- a/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h +++ b/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h @@ -32,11 +32,17 @@ protected: /// had been provided by this instance. Higher level layers are responsible /// for taking any action required to handle the missing symbols. class LinkedObjectSet { + LinkedObjectSet(const LinkedObjectSet&) LLVM_DELETED_FUNCTION; + void operator=(const LinkedObjectSet&) LLVM_DELETED_FUNCTION; public: LinkedObjectSet(std::unique_ptr MM) : MM(std::move(MM)), RTDyld(llvm::make_unique(&*this->MM)), State(Raw) {} + // MSVC 2012 cannot infer a move constructor, so write it out longhand. + LinkedObjectSet(LinkedObjectSet &&O) + : MM(std::move(O.MM)), RTDyld(std::move(O.RTDyld)), State(O.State) {} + std::unique_ptr addObject(const object::ObjectFile &Obj) { return RTDyld->loadObject(Obj); @@ -74,7 +80,7 @@ protected: public: /// @brief Handle to a set of loaded objects. - typedef typename LinkedObjectSetListT::iterator ObjSetHandleT; + typedef LinkedObjectSetListT::iterator ObjSetHandleT; }; /// @brief Default (no-op) action to perform when loading objects. @@ -94,59 +100,24 @@ public: template class ObjectLinkingLayer : public ObjectLinkingLayerBase { public: + /// @brief LoadedObjectInfo list. Contains a list of owning pointers to /// RuntimeDyld::LoadedObjectInfo instances. typedef std::vector> LoadedObjInfoList; - /// @brief Default construct an ObjectLinkingLayer. - ObjectLinkingLayer() {} - - /// @brief Construct an ObjectLinkingLayer with the given NotifyLoaded - /// functor. - ObjectLinkingLayer(NotifyLoadedFtor NotifyLoaded) - : NotifyLoaded(std::move(NotifyLoaded)) {} - - /// @brief Construct an ObjectLinkingLayer with the given NotifyFinalized - /// functor. - ObjectLinkingLayer(std::function NotifyFinalized) - : NotifyFinalized(std::move(NotifyFinalized)) {} - - /// @brief Construct an ObjectLinkingLayer with the given CreateMemoryManager - /// functor. - ObjectLinkingLayer( - std::function()> CreateMemoryManager) - : CreateMemoryManager(std::move(CreateMemoryManager)) {} - - /// @brief Construct an ObjectLinkingLayer with the given NotifyLoaded and - /// NotifyFinalized functors. - ObjectLinkingLayer(NotifyLoadedFtor NotifyLoaded, - std::function NotifyFinalized) - : NotifyLoaded(std::move(NotifyLoaded)), - NotifyFinalized(std::move(NotifyFinalized)) {} + /// @brief Functor to create RTDyldMemoryManager instances. + typedef std::function()> CreateRTDyldMMFtor; - /// @brief Construct an ObjectLinkingLayer with the given NotifyLoaded and - /// CreateMemoryManager functors. - ObjectLinkingLayer( - NotifyLoadedFtor NotifyLoaded, - std::function()> CreateMemoryManager) - : NotifyLoaded(std::move(NotifyLoaded)), - CreateMemoryManager(std::move(CreateMemoryManager)) {} - - /// @brief Construct an ObjectLinkingLayer with the given NotifyFinalized and - /// CreateMemoryManager functors. - ObjectLinkingLayer( - std::function NotifyFinalized, - std::function()> CreateMemoryManager) - : NotifyFinalized(std::move(NotifyFinalized)), - CreateMemoryManager(std::move(CreateMemoryManager)) {} + /// @brief Functor for receiving finalization notifications. + typedef std::function NotifyFinalizedFtor; /// @brief Construct an ObjectLinkingLayer with the given NotifyLoaded, /// NotifyFinalized and CreateMemoryManager functors. ObjectLinkingLayer( - NotifyLoadedFtor NotifyLoaded, - std::function NotifyFinalized, - std::function()> CreateMemoryManager) + CreateRTDyldMMFtor CreateMemoryManager = CreateRTDyldMMFtor(), + NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(), + NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor()) : NotifyLoaded(std::move(NotifyLoaded)), NotifyFinalized(std::move(NotifyFinalized)), CreateMemoryManager(std::move(CreateMemoryManager)) {} @@ -245,8 +216,8 @@ public: private: LinkedObjectSetListT LinkedObjSetList; NotifyLoadedFtor NotifyLoaded; - std::function NotifyFinalized; - std::function()> CreateMemoryManager; + NotifyFinalizedFtor NotifyFinalized; + CreateRTDyldMMFtor CreateMemoryManager; }; } // end namespace llvm