diff --git a/include/llvm/Support/CrashRecoveryContext.h b/include/llvm/Support/CrashRecoveryContext.h index 51752706d0e..f76ae3e3d49 100644 --- a/include/llvm/Support/CrashRecoveryContext.h +++ b/include/llvm/Support/CrashRecoveryContext.h @@ -116,7 +116,19 @@ public: resource->~T(); } }; - + +template +class CrashRecoveryContextDeleteCleanup + : public CrashRecoveryContextCleanup +{ + T *resource; +public: + CrashRecoveryContextDeleteCleanup(T *resource) : resource(resource) {} + virtual void recoverResources() { + delete resource; + } +}; + template struct CrashRecoveryContextTrait { static inline CrashRecoveryContextCleanup *createCleanup(T *resource) {