[llvm] [LLVM][ADT] Deprecate `make_scope_exit` in favour of CTAD (PR #174109)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 31 12:58:40 PST 2025


================
@@ -50,7 +51,13 @@ template <typename Callable> scope_exit(Callable) -> scope_exit<Callable>;
 // returned object is kept).
 //
 // Interface is specified by p0052r2.
-template <typename Callable> [[nodiscard]] auto make_scope_exit(Callable &&F) {
+template <typename Callable>
+[[nodiscard]]
+LLVM_DEPRECATED(
+    "llvm::make_scope_exit is deprecated and will be removed in LLVM 24. "
+    "Prefer calling the constructor of llvm::scope_exit directly.",
+    "scope_exit") auto make_scope_exit(Callable &&F) {
----------------
kuhar wrote:

```suggestion
    "llvm::scope_exit") auto make_scope_exit(Callable &&F) {
```
?

https://github.com/llvm/llvm-project/pull/174109


More information about the llvm-commits mailing list