summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitfca6fd4aedb32e173565af204866dee62dcfd054 (patch)
treeb44cc70418cf0a068c7578a93df4ccdedf10e0c9 /llvm/include
parent7ef5cb3038fcbd4caa102d1ce9d70ae598985a7c (diff)
downloadbcm5719-llvm-fca6fd4aedb32e173565af204866dee62dcfd054.tar.gz
bcm5719-llvm-fca6fd4aedb32e173565af204866dee62dcfd054.zip
Add new CrashRecoveryContextCleanup subclass: CrashRecoveryContextDeleteCleanup. This deletes the object, not just calls its destructor.
llvm-svn: 127855
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Support/CrashRecoveryContext.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/include/llvm/Support/CrashRecoveryContext.h b/llvm/include/llvm/Support/CrashRecoveryContext.h
index 51752706d0e..f76ae3e3d49 100644
--- a/llvm/include/llvm/Support/CrashRecoveryContext.h
+++ b/llvm/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) {
OpenPOWER on IntegriCloud