From 0597234028d14e454673bec8d8196285a9712364 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 18 Mar 2011 03:04:18 +0000 Subject: [PATCH] Add new CrashRecoveryContextCleanup subclass: CrashRecoveryContextDeleteCleanup. This deletes the object, not just calls its destructor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127855 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/CrashRecoveryContext.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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) {