[lldb] [llvm] [ADT] Remove deprecated llvm::make_scope_exit (PR #212987)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 03:28:08 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Marc Auberer (marcauberer)
<details>
<summary>Changes</summary>
Update remaining call sites in lldb to construct llvm::scope_exit directly, per the deprecation notice.
---
Full diff: https://github.com/llvm/llvm-project/pull/212987.diff
4 Files Affected:
- (modified) lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm (+3-3)
- (modified) lldb/source/Host/windows/DomainSocketWindows.cpp (+1-1)
- (modified) lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp (+4-4)
- (modified) llvm/include/llvm/ADT/ScopeExit.h (+1-15)
``````````diff
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..ef87fe0831a0f 100644
--- a/lldb/source/Host/windows/DomainSocketWindows.cpp
+++ b/lldb/source/Host/windows/DomainSocketWindows.cpp
@@ -31,7 +31,7 @@ llvm::Expected<DomainSocket::Pair> DomainSocketWindows::CreatePair() {
llvm::SmallString<128> path;
llvm::sys::fs::createUniquePath(model, path, /*MakeAbsolute=*/false);
auto remove_file =
- llvm::make_scope_exit([&] { llvm::sys::fs::remove(path); });
+ 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/212987
More information about the llvm-commits
mailing list