Skip to content

Commit 28d2310

Browse files
committed
[LLVM][ADT] Make scope-exit CTAD-capable
1 parent b1d0e5f commit 28d2310

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

llvm/include/llvm/ADT/ScopeExit.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@
1515
#ifndef LLVM_ADT_SCOPEEXIT_H
1616
#define LLVM_ADT_SCOPEEXIT_H
1717

18-
#include "llvm/Support/Compiler.h"
19-
20-
#include <type_traits>
2118
#include <utility>
2219

2320
namespace llvm {
24-
namespace detail {
2521

2622
template <typename Callable> class scope_exit {
2723
Callable ExitFunction;
@@ -47,17 +43,15 @@ template <typename Callable> class scope_exit {
4743
}
4844
};
4945

50-
} // end namespace detail
46+
template <typename Callable> scope_exit(Callable) -> scope_exit<Callable>;
5147

5248
// Keeps the callable object that is passed in, and execute it at the
5349
// destruction of the returned object (usually at the scope exit where the
5450
// returned object is kept).
5551
//
5652
// Interface is specified by p0052r2.
57-
template <typename Callable>
58-
[[nodiscard]] detail::scope_exit<std::decay_t<Callable>>
59-
make_scope_exit(Callable &&F) {
60-
return detail::scope_exit<std::decay_t<Callable>>(std::forward<Callable>(F));
53+
template <typename Callable> [[nodiscard]] auto make_scope_exit(Callable &&F) {
54+
return scope_exit(std::forward<Callable>(F));
6155
}
6256

6357
} // end namespace llvm

0 commit comments

Comments
 (0)