diff --git a/unittests/ExecutionEngine/Orc/OrcTestCommon.h b/unittests/ExecutionEngine/Orc/OrcTestCommon.h index 96e89d7a806..d2521587ebd 100644 --- a/unittests/ExecutionEngine/Orc/OrcTestCommon.h +++ b/unittests/ExecutionEngine/Orc/OrcTestCommon.h @@ -201,89 +201,6 @@ inline StructType *getDummyStructTy(LLVMContext &Context) { return StructType::get(ArrayType::get(Type::getInt32Ty(Context), 256)); } -template -class MockBaseLayer { -public: - - using ModuleHandleT = HandleT; - - using AddModuleSignature = - Expected(ModuleT M, - std::shared_ptr R); - - using RemoveModuleSignature = Error(ModuleHandleT H); - using FindSymbolSignature = JITSymbol(const std::string &Name, - bool ExportedSymbolsOnly); - using FindSymbolInSignature = JITSymbol(ModuleHandleT H, - const std::string &Name, - bool ExportedSymbolsONly); - using EmitAndFinalizeSignature = Error(ModuleHandleT H); - - std::function addModuleImpl; - std::function removeModuleImpl; - std::function findSymbolImpl; - std::function findSymbolInImpl; - std::function emitAndFinalizeImpl; - - Expected addModule(ModuleT M, - std::shared_ptr R) { - assert(addModuleImpl && - "addModule called, but no mock implementation was provided"); - return addModuleImpl(std::move(M), std::move(R)); - } - - Error removeModule(ModuleHandleT H) { - assert(removeModuleImpl && - "removeModule called, but no mock implementation was provided"); - return removeModuleImpl(H); - } - - JITSymbol findSymbol(const std::string &Name, bool ExportedSymbolsOnly) { - assert(findSymbolImpl && - "findSymbol called, but no mock implementation was provided"); - return findSymbolImpl(Name, ExportedSymbolsOnly); - } - - JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name, - bool ExportedSymbolsOnly) { - assert(findSymbolInImpl && - "findSymbolIn called, but no mock implementation was provided"); - return findSymbolInImpl(H, Name, ExportedSymbolsOnly); - } - - Error emitAndFinaliez(ModuleHandleT H) { - assert(emitAndFinalizeImpl && - "emitAndFinalize called, but no mock implementation was provided"); - return emitAndFinalizeImpl(H); - } -}; - -class ReturnNullJITSymbol { -public: - template - JITSymbol operator()(Args...) const { - return nullptr; - } -}; - -template -class DoNothingAndReturn { -public: - DoNothingAndReturn(ReturnT Ret) : Ret(std::move(Ret)) {} - - template - void operator()(Args...) const { return Ret; } -private: - ReturnT Ret; -}; - -template <> -class DoNothingAndReturn { -public: - template - void operator()(Args...) const { } -}; - } // namespace llvm #endif