<div class="gmail_quote">On Fri, Jun 1, 2012 at 7:30 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On Jun 1, 2012, at 7:08 PM, Caldarale, Charles R wrote:<br>
<br>
>> From: <a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a>] On Behalf Of Chris Lattner<br>
>> Subject: Re: [LLVMdev] [llvm-commits] [PATCH] Allow per-thread re-direction of outs()/errs()<br>
><br>
>> It would be much better for the linker to return its error in a proper way<br>
>> (i.e. extending llvm/Support/system_error.h like llvm/Object/Error.h does).<br>
><br>
>> The right fix for this is to fix the code to not report errors textually.<br>
><br>
> Unfortunately, the use of outs() and (especially) errs() is rampant - a simple grep of the 3.1 source tree shows about 1,500 instances.  One of the first things we had to implement in order to make LLVM usable is something very similar to what Justin has proposed.  Centralizing control of the output in outs()/errs() would seem to be an ideal way to let users of LLVM as a library customize it as they see fit without requiring massive source changes.<br>

<br>
</div>Virtually all of those are in DEBUG statements or in llvm/tools.  Neither are relevant to the discussion.<br></blockquote><div><br></div><div>In a way, they are.  What if I want a debug trace in a multi-threaded context?  Right now, all threads would just spew to the same stream and the result would be unreadable.  If you allow threads to setup their own outs() and errs() streams (transparently to the rest of LLVM), you can intercept these as you see fit, perhaps dumping each to a separate file.  I acknowledge that you could also enforce single-threaded execution for debug runs, but what if you are in the context of a library with no valid stdout/stderr buffers?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-Chris<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div><br>