Point people to ConstantExpr and ConstantFolding,
[oota-llvm.git] / include / llvm / Support / ManagedStatic.h
index e1585bafa80d28fc4083ea679656cd8311d80e64..28b25dbb623b0b9b90b216f50c9af81185a53858 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Chris Lattner and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -34,6 +34,9 @@ protected:
   
   void RegisterManagedStatic(void *ObjPtr, void (*deleter)(void*)) const;
 public:
+  /// isConstructed - Return true if this object has not been created yet.  
+  bool isConstructed() const { return Ptr != 0; }
+  
   void destroy() const;
 };
 
@@ -70,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();