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();
46
46
LLVM_ABI void runOnNewStack (unsigned StackSize, function_ref<void ()> Fn);
47
47
48
48
template <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,
58
50
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
+ }
60
58
}
61
59
62
60
} // namespace llvm
You can’t perform that action at this time.
0 commit comments