From: Lang Hames Date: Tue, 3 Jan 2023 01:48:55 +0000 (-0800) Subject: [ORC] Rename ThreadSafeModule::takingModuleDo to consumingModuleDo. X-Git-Tag: upstream/17.0.6~22357 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae331245b730a2c91ecc227c4cb1198d2b3ad94e;p=platform%2Fupstream%2Fllvm.git [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). --- diff --git a/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h b/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h index bc346425..8ebbf8b 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h @@ -147,7 +147,7 @@ public: /// Locks the associated ThreadSafeContext and calls the given function, /// passing the contained std::unique_ptr. The given function should /// consume the Module. - template decltype(auto) takingModuleDo(Func &&F) { + template decltype(auto) consumingModuleDo(Func &&F) { auto Lock = TSCtx.getLock(); return F(std::move(M)); } diff --git a/llvm/unittests/ExecutionEngine/Orc/ThreadSafeModuleTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ThreadSafeModuleTest.cpp index 1cda029..5b094e2 100644 --- a/llvm/unittests/ExecutionEngine/Orc/ThreadSafeModuleTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/ThreadSafeModuleTest.cpp @@ -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()); ThreadSafeModule TSM(std::make_unique("M", *TSCtx.getContext()), TSCtx); - TSM.takingModuleDo([](std::unique_ptr M) {}); + TSM.consumingModuleDo([](std::unique_ptr M) {}); } } // end anonymous namespace