summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-03-18 03:04:18 +0000
committerTed Kremenek <kremenek@apple.com>2011-03-18 03:04:18 +0000
commit0597234028d14e454673bec8d8196285a9712364 (patch)
tree51393bd17f491cd763df11d679208edea7f51bc6 /include
parent49ab1207df3d7d5a4bb3b3e3dcc611e78d262714 (diff)
downloadllvm-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.h14
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) {