diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-03-18 03:04:18 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-03-18 03:04:18 +0000 |
commit | 0597234028d14e454673bec8d8196285a9712364 (patch) | |
tree | 51393bd17f491cd763df11d679208edea7f51bc6 /include | |
parent | 49ab1207df3d7d5a4bb3b3e3dcc611e78d262714 (diff) | |
download | llvm-0597234028d14e454673bec8d8196285a9712364.tar.gz llvm-0597234028d14e454673bec8d8196285a9712364.tar.bz2 llvm-0597234028d14e454673bec8d8196285a9712364.tar.xz |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Support/CrashRecoveryContext.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/llvm/Support/CrashRecoveryContext.h b/include/llvm/Support/CrashRecoveryContext.h index 51752706d0..f76ae3e3d4 100644 --- a/include/llvm/Support/CrashRecoveryContext.h +++ b/include/llvm/Support/CrashRecoveryContext.h @@ -116,7 +116,19 @@ public: resource->~T(); } }; - + +template <typename T> +class CrashRecoveryContextDeleteCleanup + : public CrashRecoveryContextCleanup +{ + T *resource; +public: + CrashRecoveryContextDeleteCleanup(T *resource) : resource(resource) {} + virtual void recoverResources() { + delete resource; + } +}; + template <typename T> struct CrashRecoveryContextTrait { static inline CrashRecoveryContextCleanup *createCleanup(T *resource) { |