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 class scope_exit { public: template - explicit scope_exit(Fp &&F) : ExitFunction(std::forward(F)) {} + [[nodiscard]] explicit scope_exit(Fp &&F) + : ExitFunction(std::forward(F)) {} - scope_exit(scope_exit &&Rhs) + [[nodiscard]] scope_exit(scope_exit &&Rhs) : ExitFunction(std::move(Rhs.ExitFunction)), Engaged(Rhs.Engaged) { Rhs.release(); }