[llvm] 289a456 - [ADT] Remove deprecated llvm::make_scope_exit (#212987)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 05:58:53 PDT 2026
Author: Marc Auberer
Date: 2026-07-30T14:58:46+02:00
New Revision: 289a4568f7d18d1d42687f3a2fc2c72bcbadaa28
URL: https://github.com/llvm/llvm-project/commit/289a4568f7d18d1d42687f3a2fc2c72bcbadaa28
DIFF: https://github.com/llvm/llvm-project/commit/289a4568f7d18d1d42687f3a2fc2c72bcbadaa28.diff
LOG: [ADT] Remove deprecated llvm::make_scope_exit (#212987)
Update remaining call sites in lldb to construct llvm::scope_exit
directly, per the deprecation notice.
---------
Co-authored-by: Claude <noreply at anthropic.com>
Added:
Modified:
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
lldb/source/Host/windows/DomainSocketWindows.cpp
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
llvm/include/llvm/ADT/ScopeExit.h
Removed:
################################################################################
diff --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index 5b3590f5e3f8d..8091e2d799914 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -1119,13 +1119,13 @@ static DataExtractorSP map_shared_cache_binary_segments(void *image) {
path.size(), /*isDirectory=*/true);
if (!url)
return false;
- auto url_cleanup = llvm::make_scope_exit([&]() { CFRelease(url); });
+ auto url_cleanup = llvm::scope_exit([&]() { CFRelease(url); });
SecStaticCodeRef static_code = nullptr;
if (SecStaticCodeCreateWithPath(url, kSecCSDefaultFlags, &static_code) !=
errSecSuccess)
return false;
- auto code_cleanup = llvm::make_scope_exit([&]() { CFRelease(static_code); });
+ auto code_cleanup = llvm::scope_exit([&]() { CFRelease(static_code); });
// Check that the signature chains to a trusted root CA.
SecRequirementRef requirement = nullptr;
@@ -1133,7 +1133,7 @@ static DataExtractorSP map_shared_cache_binary_segments(void *image) {
kSecCSDefaultFlags,
&requirement) != errSecSuccess)
return false;
- auto req_cleanup = llvm::make_scope_exit([&]() { CFRelease(requirement); });
+ auto req_cleanup = llvm::scope_exit([&]() { CFRelease(requirement); });
return SecStaticCodeCheckValidity(static_code, kSecCSDefaultFlags,
requirement) == errSecSuccess;
diff --git a/lldb/source/Host/windows/DomainSocketWindows.cpp b/lldb/source/Host/windows/DomainSocketWindows.cpp
index eddc7a955ad38..0dd10697ffe69 100644
--- a/lldb/source/Host/windows/DomainSocketWindows.cpp
+++ b/lldb/source/Host/windows/DomainSocketWindows.cpp
@@ -30,8 +30,7 @@ llvm::Expected<DomainSocket::Pair> DomainSocketWindows::CreatePair() {
llvm::sys::path::append(model, "lldb-domain-socketpair-%%%%%%%%.sock");
llvm::SmallString<128> path;
llvm::sys::fs::createUniquePath(model, path, /*MakeAbsolute=*/false);
- auto remove_file =
- llvm::make_scope_exit([&] { llvm::sys::fs::remove(path); });
+ auto remove_file = llvm::scope_exit([&] { llvm::sys::fs::remove(path); });
auto listen_socket =
std::make_unique<DomainSocketWindows>(/*should_close=*/true);
diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
index 8b1d7276d00bd..2a09c42531074 100644
--- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
@@ -308,7 +308,7 @@ Status NativeRegisterContextWindows_arm64::GPRRead(const uint32_t reg,
Status
NativeRegisterContextWindows_arm64::GPRWrite(const uint32_t reg,
const RegisterValue ®_value) {
- auto cleanup = llvm::make_scope_exit([&]() { m_context = nullptr; });
+ auto cleanup = llvm::scope_exit([&]() { m_context = nullptr; });
PCONTEXT context = nullptr;
DataBufferHeap context_buffer;
@@ -533,7 +533,7 @@ Status NativeRegisterContextWindows_arm64::FPRRead(const uint32_t reg,
Status
NativeRegisterContextWindows_arm64::FPRWrite(const uint32_t reg,
const RegisterValue ®_value) {
- auto cleanup = llvm::make_scope_exit([&]() { m_context = nullptr; });
+ auto cleanup = llvm::scope_exit([&]() { m_context = nullptr; });
PCONTEXT context = nullptr;
DataBufferHeap context_buffer;
@@ -743,7 +743,7 @@ Status NativeRegisterContextWindows_arm64::ReadAllRegisterValues(
Status NativeRegisterContextWindows_arm64::WriteAllRegisterValues(
const lldb::DataBufferSP &data_sp) {
- auto cleanup = llvm::make_scope_exit([&]() { m_context = nullptr; });
+ auto cleanup = llvm::scope_exit([&]() { m_context = nullptr; });
Log *log = GetLog(WindowsLog::Registers);
Status error;
@@ -796,7 +796,7 @@ llvm::Error NativeRegisterContextWindows_arm64::ReadHardwareDebugInfo() {
llvm::Error
NativeRegisterContextWindows_arm64::WriteHardwareDebugRegs(DREGType hwbType) {
- auto cleanup = llvm::make_scope_exit([&]() { m_context = nullptr; });
+ auto cleanup = llvm::scope_exit([&]() { m_context = nullptr; });
PCONTEXT context = nullptr;
DataBufferHeap context_buffer;
diff --git a/llvm/include/llvm/ADT/ScopeExit.h b/llvm/include/llvm/ADT/ScopeExit.h
index a8943c680f4e1..2a014e508110a 100644
--- a/llvm/include/llvm/ADT/ScopeExit.h
+++ b/llvm/include/llvm/ADT/ScopeExit.h
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// This file defines the make_scope_exit function, which executes user-defined
+/// This file defines the scope_exit class, which executes user-defined
/// cleanup logic at scope exit.
///
//===----------------------------------------------------------------------===//
@@ -15,7 +15,6 @@
#ifndef LLVM_ADT_SCOPEEXIT_H
#define LLVM_ADT_SCOPEEXIT_H
-#include "llvm/Support/Compiler.h"
#include <utility>
namespace llvm {
@@ -46,19 +45,6 @@ template <typename Callable> class [[nodiscard]] scope_exit {
template <typename Callable> scope_exit(Callable) -> scope_exit<Callable>;
-// Keeps the callable object that is passed in, and execute it at the
-// destruction of the returned object (usually at the scope exit where the
-// returned object is kept).
-//
-// Interface is specified by p0052r2.
-template <typename Callable>
-[[nodiscard]]
-LLVM_DEPRECATED("Prefer calling the constructor of llvm::scope_exit directly.",
- "scope_exit") auto make_scope_exit(Callable &&F) {
- // TODO(LLVM 24): Remove this function.
- return scope_exit(std::forward<Callable>(F));
-}
-
} // end namespace llvm
#endif
More information about the llvm-commits
mailing list