class CrashRecoveryContextCleanupRegistrar

Declaration

template <typename T,
          typename Cleanup = CrashRecoveryContextDeleteCleanup<T>>
class CrashRecoveryContextCleanupRegistrar { /* full declaration omitted */ };

Description

Helper class for managing resource cleanups. 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.

Declared at: llvm/include/llvm/Support/CrashRecoveryContext.h:246

Templates

T
Type of resource been reclaimed.
Cleanup = CrashRecoveryContextDeleteCleanup<T>
Class that defines how the resource is reclaimed.

Method Overview

Methods

CrashRecoveryContextCleanupRegistrar<T, Cleanup>(
    T* x)

Declared at: llvm/include/llvm/Support/CrashRecoveryContext.h:250

Parameters

T* x

void unregister()

Declared at: llvm/include/llvm/Support/CrashRecoveryContext.h:258

~CrashRecoveryContextCleanupRegistrar<T,
                                      Cleanup>()

Declared at: llvm/include/llvm/Support/CrashRecoveryContext.h:256