[llvm] [llvm][ADT] Mark scope_exit contructors [[nodiscard]] (PR #179720)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 4 10:02:37 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Balázs Benics (steakhal)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/179720.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/ScopeExit.h (+3-2)
``````````diff
diff --git a/llvm/include/llvm/ADT/ScopeExit.h b/llvm/include/llvm/ADT/ScopeExit.h
index 1c0d52eb58aca..6bf1a62846294 100644
--- a/llvm/include/llvm/ADT/ScopeExit.h
+++ b/llvm/include/llvm/ADT/ScopeExit.h
@@ -26,9 +26,10 @@ template <typename Callable> class scope_exit {
public:
template <typename Fp>
- explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {}
+ [[nodiscard]] explicit scope_exit(Fp &&F)
+ : ExitFunction(std::forward<Fp>(F)) {}
- scope_exit(scope_exit &&Rhs)
+ [[nodiscard]] scope_exit(scope_exit &&Rhs)
: ExitFunction(std::move(Rhs.ExitFunction)), Engaged(Rhs.Engaged) {
Rhs.release();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/179720
More information about the llvm-commits
mailing list