mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[ORC] Remove some stale unit test utils.
This code was used to test ORCv1, which has been removed. It is not useful for testing ORCv2.
This commit is contained in:
parent
4eed210a79
commit
7eb0435795
@ -201,89 +201,6 @@ inline StructType *getDummyStructTy(LLVMContext &Context) {
|
||||
return StructType::get(ArrayType::get(Type::getInt32Ty(Context), 256));
|
||||
}
|
||||
|
||||
template <typename HandleT, typename ModuleT>
|
||||
class MockBaseLayer {
|
||||
public:
|
||||
|
||||
using ModuleHandleT = HandleT;
|
||||
|
||||
using AddModuleSignature =
|
||||
Expected<ModuleHandleT>(ModuleT M,
|
||||
std::shared_ptr<JITSymbolResolver> 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<AddModuleSignature> addModuleImpl;
|
||||
std::function<RemoveModuleSignature> removeModuleImpl;
|
||||
std::function<FindSymbolSignature> findSymbolImpl;
|
||||
std::function<FindSymbolInSignature> findSymbolInImpl;
|
||||
std::function<EmitAndFinalizeSignature> emitAndFinalizeImpl;
|
||||
|
||||
Expected<ModuleHandleT> addModule(ModuleT M,
|
||||
std::shared_ptr<JITSymbolResolver> 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 <typename... Args>
|
||||
JITSymbol operator()(Args...) const {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ReturnT>
|
||||
class DoNothingAndReturn {
|
||||
public:
|
||||
DoNothingAndReturn(ReturnT Ret) : Ret(std::move(Ret)) {}
|
||||
|
||||
template <typename... Args>
|
||||
void operator()(Args...) const { return Ret; }
|
||||
private:
|
||||
ReturnT Ret;
|
||||
};
|
||||
|
||||
template <>
|
||||
class DoNothingAndReturn<void> {
|
||||
public:
|
||||
template <typename... Args>
|
||||
void operator()(Args...) const { }
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user