aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {