mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 03:56:08 +00:00
[ORC] Rename ThreadSafeModule::takingModuleDo to consumingModuleDo.
Renamed to emphasize intent: this method allows the module to be consumed by the callback (while protected by the context lock), but we don't want to imply that the Module could be taken out of the ThreadSafeModule (where it would no longer be protected by that lock).
This commit is contained in:
parent
0bf85d7d81
commit
ae331245b7
@ -147,7 +147,7 @@ public:
|
||||
/// Locks the associated ThreadSafeContext and calls the given function,
|
||||
/// passing the contained std::unique_ptr<Module>. The given function should
|
||||
/// consume the Module.
|
||||
template <typename Func> decltype(auto) takingModuleDo(Func &&F) {
|
||||
template <typename Func> decltype(auto) consumingModuleDo(Func &&F) {
|
||||
auto Lock = TSCtx.getLock();
|
||||
return F(std::move(M));
|
||||
}
|
||||
|
@ -107,12 +107,12 @@ TEST(ThreadSafeModuleTest, WithModuleDoConst) {
|
||||
TSM.withModuleDo([](const Module &M) {});
|
||||
}
|
||||
|
||||
TEST(ThreadSafeModuleTest, TakingModuleDo) {
|
||||
// Test takingModuleDo.
|
||||
TEST(ThreadSafeModuleTest, ConsumingModuleDo) {
|
||||
// Test consumingModuleDo.
|
||||
ThreadSafeContext TSCtx(std::make_unique<LLVMContext>());
|
||||
ThreadSafeModule TSM(std::make_unique<Module>("M", *TSCtx.getContext()),
|
||||
TSCtx);
|
||||
TSM.takingModuleDo([](std::unique_ptr<Module> M) {});
|
||||
TSM.consumingModuleDo([](std::unique_ptr<Module> M) {});
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
Loading…
x
Reference in New Issue
Block a user