[PATCH] PrettyStackTrace should use ManagedStatic for its ThreadLocal

Filip Pizlo fpizlo at apple.com
Thu Sep 12 18:33:57 PDT 2013


On Sep 12, 2013, at 5:49 PM, Dan Gohman <sunfish at google.com> wrote:

> On Thu, Sep 12, 2013 at 5:00 PM, Filip Pizlo <fpizlo at apple.com> wrote:
>> 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?
> 
> The issue is that it needs to detect pending I/O errors.

What would you do with pending I/O errors in an atexit() handler?

> 
>> In that case why not do the equivalent of _setvbuf?
> 
> _setvbuf is for libc buffering. raw_ostream's implementation was
> designed to avoid libc buffering because it wasn't as fast.

I understand that _setvbuf is for libc.  But why can't raw_ostream do the equivalent for the purpose of llvm::outs()?  Is the concern that a program might use outs() (i.e. outputting to stdout) so heavily that buffering becomes critical?

> 
> Dan

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


More information about the llvm-commits mailing list