14 #ifndef LLVM_SUPPORT_MANAGEDSTATIC_H 15 #define LLVM_SUPPORT_MANAGEDSTATIC_H 24 static void *
call() {
return new C(); }
30 static void call(
void *Ptr) {
delete (
T *)Ptr; }
33 static void call(
void *Ptr) {
delete[](
T *)Ptr; }
41 mutable std::atomic<void *>
Ptr;
42 mutable void (*DeleterFn)(
void*);
45 void RegisterManagedStatic(
void *(*creator)(),
void (*
deleter)(
void*))
const;
59 template <
class C,
class Creator =
object_creator<C>,
60 class Deleter =
object_deleter<C>>
65 void *Tmp = Ptr.load(std::memory_order_acquire);
67 RegisterManagedStatic(Creator::call, Deleter::call);
69 return *
static_cast<C *
>(Ptr.load(std::memory_order_relaxed));
75 void *Tmp = Ptr.load(std::memory_order_acquire);
77 RegisterManagedStatic(Creator::call, Deleter::call);
79 return *
static_cast<C *
>(Ptr.load(std::memory_order_relaxed));
97 #endif // LLVM_SUPPORT_MANAGEDSTATIC_H
This class represents lattice values for constants.
const ManagedStaticBase * Next
static void call(void *Ptr)
object_deleter - Helper method for ManagedStatic.
void llvm_shutdown()
llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
const C & operator*() const
std::atomic< void * > Ptr
const C * operator->() const
ManagedStaticBase - Common base class for ManagedStatic instances.
bool isConstructed() const
isConstructed - Return true if this object has not been created yet.
static void call(void *Ptr)
llvm_shutdown_obj - This is a simple helper class that calls llvm_shutdown() when it is destroyed...
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
object_creator - Helper method for ManagedStatic.