summaryrefslogtreecommitdiff
path: root/include/llvm/Support/ManagedStatic.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-20 06:08:37 +0000
committerChris Lattner <sabre@nondot.org>2007-02-20 06:08:37 +0000
commitb4d7e35dde3ccbe0dc10bf13332ade9812586dd0 (patch)
tree31d91d725cf18cc1b349a48bbb81c94172243dbb /include/llvm/Support/ManagedStatic.h
parenteb41bddfdf6378ce407af2c03ee21fb1227eceec (diff)
downloadllvm-b4d7e35dde3ccbe0dc10bf13332ade9812586dd0.tar.gz
llvm-b4d7e35dde3ccbe0dc10bf13332ade9812586dd0.tar.bz2
llvm-b4d7e35dde3ccbe0dc10bf13332ade9812586dd0.tar.xz
add a way to register an arbitrary cleanup function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34442 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/ManagedStatic.h')
-rw-r--r--include/llvm/Support/ManagedStatic.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/Support/ManagedStatic.h b/include/llvm/Support/ManagedStatic.h
index a9e7e96b5d..e65fb1b646 100644
--- a/include/llvm/Support/ManagedStatic.h
+++ b/include/llvm/Support/ManagedStatic.h
@@ -73,6 +73,12 @@ public:
}
};
+template<void (*CleanupFn)(void*)>
+class ManagedCleanup : public ManagedStaticBase {
+public:
+ void Register() { RegisterManagedStatic(0, CleanupFn); }
+};
+
/// llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
void llvm_shutdown();