File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
llvm/include/llvm/Support Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -46,17 +46,15 @@ LLVM_ABI unsigned getDefaultStackSize();
4646LLVM_ABI void runOnNewStack (unsigned StackSize, function_ref<void ()> Fn);
4747
4848template <typename R, typename ... Ts>
49- std::enable_if_t <!std::is_same_v<R, void >, R>
50- runOnNewStack (unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
51- std::optional<R> Ret;
52- runOnNewStack (StackSize, [&]() { Ret = Fn (std::forward<Ts>(Args)...); });
53- return std::move (*Ret);
54- }
55-
56- template <typename ... Ts>
57- void runOnNewStack (unsigned StackSize, function_ref<void (Ts...)> Fn,
49+ auto runOnNewStack (unsigned StackSize, function_ref<R(Ts...)> Fn,
5850 Ts &&...Args) {
59- runOnNewStack (StackSize, [&]() { Fn (std::forward<Ts>(Args)...); });
51+ if constexpr (std::is_same_v<R, void >) {
52+ runOnNewStack (StackSize, [&]() { Fn (std::forward<Ts>(Args)...); });
53+ } else {
54+ std::optional<R> Ret;
55+ runOnNewStack (StackSize, [&]() { Ret = Fn (std::forward<Ts>(Args)...); });
56+ return std::move (*Ret);
57+ }
6058}
6159
6260} // namespace llvm
You can’t perform that action at this time.
0 commit comments