LLVM 20.0.0git
|
Helper class for managing resource cleanups. More...
#include "llvm/Support/CrashRecoveryContext.h"
Public Member Functions | |
CrashRecoveryContextCleanupRegistrar (T *x) | |
~CrashRecoveryContextCleanupRegistrar () | |
void | unregister () |
Helper class for managing resource cleanups.
T | Type of resource been reclaimed. |
Cleanup | Class that defines how the resource is reclaimed. |
Clients create objects of this type in the code executed in a crash recovery context to ensure that the resource will be reclaimed even in the case of crash. For example:
If the code of actual_work
in the example above does not crash, the destructor of CrashRecoveryContextCleanupRegistrar removes cleanup code from the current CrashRecoveryContext and the resource is reclaimed by the destructor of std::unique_ptr. If crash happens, destructors are not called and the resource is reclaimed by cleanup object registered in the recovery context by the constructor of CrashRecoveryContextCleanupRegistrar.
Definition at line 252 of file CrashRecoveryContext.h.
|
inline |
Definition at line 256 of file CrashRecoveryContext.h.
References llvm::CrashRecoveryContextCleanup::getContext(), and llvm::CrashRecoveryContext::registerCleanup().
|
inline |
Definition at line 262 of file CrashRecoveryContext.h.
References llvm::CrashRecoveryContextCleanupRegistrar< T, Cleanup >::unregister().
|
inline |
Definition at line 264 of file CrashRecoveryContext.h.
References llvm::CrashRecoveryContextCleanup::cleanupFired, llvm::CrashRecoveryContextCleanup::getContext(), and llvm::CrashRecoveryContext::unregisterCleanup().
Referenced by llvm::CrashRecoveryContextCleanupRegistrar< T, Cleanup >::~CrashRecoveryContextCleanupRegistrar().