[llvm] 2d4e545 - [ORC] Return bootstrap map values via reference argument.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 19:11:54 PDT 2023
Author: Lang Hames
Date: 2023-04-04T19:11:48-07:00
New Revision: 2d4e545b7bc638d9325b16dfd667db5163d4d5d4
URL: https://github.com/llvm/llvm-project/commit/2d4e545b7bc638d9325b16dfd667db5163d4d5d4
DIFF: https://github.com/llvm/llvm-project/commit/2d4e545b7bc638d9325b16dfd667db5163d4d5d4.diff
LOG: [ORC] Return bootstrap map values via reference argument.
This simplifies checking of the result (it's just an Error, rather than an
optional<Expected<T>>), and allows T to be deduced rather than requiring that
it be specified.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
index 49ae55bac1ab7..a16a3b9f92a1b 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
@@ -227,18 +227,22 @@ class ExecutorProcessControl {
///
///
template <typename T, typename SPSTagT>
- std::optional<Expected<T>> getBootstrapMapValue(StringRef Key) const {
+ Error getBootstrapMapValue(StringRef Key, std::optional<T> &Val) const {
+ Val = std::nullopt;
+
auto I = BootstrapMap.find(Key);
if (I == BootstrapMap.end())
- return std::nullopt;
+ return Error::success();
- T Val;
+ T Tmp;
shared::SPSInputBuffer IB(I->second.data(), I->second.size());
- if (!shared::SPSArgList<SPSTagT>::deserialize(IB, Val))
+ if (!shared::SPSArgList<SPSTagT>::deserialize(IB, Tmp))
return make_error<StringError>("Could not deserialize value for key " +
Key,
inconvertibleErrorCode());
- return Val;
+
+ Val = std::move(Tmp);
+ return Error::success();
}
/// Returns the bootstrap symbol map.
More information about the llvm-commits
mailing list