[LLVMdev] ManagedStatic and order of destruction

Justin Holewinski justin.holewinski at gmail.com
Tue Feb 12 10:31:13 PST 2013


Ping.  Anyone with knowledge of detailed knowledge of the ManagedStatic
implementation?

The use-case we are looking at is getting rid of llvm_shutdown() by
cleaning up the ManagedStatic data when the global destructors run.


On Sat, Feb 9, 2013 at 5:25 PM, Justin Holewinski <
justin.holewinski at gmail.com> wrote:

> I'm curious about the design rationale for how ManagedStatic instances are
> cleaned up, and I'm hoping someone can shed some light on it.
>
> Currently, ManagedStatic objects are cleaned up when llvm_shutdown()
> traverses the global list of initialized objects and calls destroy() on
> each.  This leads to two questions:
>
> 1. An assertion enforces that the objects are deleted in reverse order of
> allocation.  Is there any hard requirement for this, or is it only because
> of the way the linked list is created?
>
> 2. Would anything change (functionally) if we simply called destroy() in
> the ManagedStatic destructor?  Wouldn't this be safer than relying on a
> client to call llvm_shutdown()?  It seems like the whole purpose of
> llvm_shutdown() is to allow clients to free the data allocated by
> ManagedStatic instances.  Could we not just give them an option, but by
> default clean up during global destruction?
>
> --
>
> Thanks,
>
> Justin Holewinski
>



-- 

Thanks,

Justin Holewinski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130212/620ce9f1/attachment.html>


More information about the llvm-dev mailing list