[PATCH] PrettyStackTrace should use ManagedStatic for its ThreadLocal

Filip Pizlo fpizlo at apple.com
Thu Sep 12 17:00:17 PDT 2013


BTW, what do you think of my new patch?

On Sep 12, 2013, at 4:38 PM, Reid Kleckner <rnk at google.com> wrote:

> On Thu, Sep 12, 2013 at 2:13 PM, Filip Pizlo <fpizlo at apple.com> wrote:
>> <snip>
> 
> 
> I know that you could argue that clients of LLVM should always call llvm_shutdown().  This will probably work for a lot of clients where the relationship between the outer application and LLVM isn't transitive through multiple intervening libraries.  We certainly can't change our API to require our client to destroy the global VM, and it would be silly if that blocked us from ever using LLVM to compile any code due to exit-time crashes.
> 
> You know, clang might not even call llvm_shutdown() if -disable_free is set, and that should be fine.  :)
>> 
>> Then we could convert llvm::outs() to use it, thereby potential initialization races on Windows.
> 
> Er, "thereby *fixing* potential races"
> 
> Interesting.  Can you elaborate what the problem is there?
> 
> llvm::outs() has a static local that closes stdout in its destructor.  Obviously, this *really* has to run atexit, and probably can't run at llvm_shutdown() time.  Alternatively, it shouldn't close stdout.

Is the issue just that you want it to flush its output?

In that case why not do the equivalent of _setvbuf?

-Filip


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130912/ca9a6e95/attachment.html>


More information about the llvm-commits mailing list