[llvm-commits] [llvm] r127855 - /llvm/trunk/include/llvm/Support/CrashRecoveryContext.h
Ted Kremenek
kremenek at apple.com
Thu Mar 17 20:04:18 PDT 2011
Author: kremenek
Date: Thu Mar 17 22:04:18 2011
New Revision: 127855
URL: http://llvm.org/viewvc/llvm-project?rev=127855&view=rev
Log:
Add new CrashRecoveryContextCleanup subclass: CrashRecoveryContextDeleteCleanup. This deletes the object, not just calls its destructor.
Modified:
llvm/trunk/include/llvm/Support/CrashRecoveryContext.h
Modified: llvm/trunk/include/llvm/Support/CrashRecoveryContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CrashRecoveryContext.h?rev=127855&r1=127854&r2=127855&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CrashRecoveryContext.h (original)
+++ llvm/trunk/include/llvm/Support/CrashRecoveryContext.h Thu Mar 17 22:04:18 2011
@@ -116,7 +116,19 @@
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) {
More information about the llvm-commits
mailing list