[LLVMdev] [PATCH] Allow per-thread re-direction of outs()/errs()

Justin Holewinski jholewinski at nvidia.com
Thu May 31 14:39:24 PDT 2012


The attached patch add the ability to programmatically re-direct outs()/errs() to an arbitrary raw_ostream instance, maintaining the raw_ostream instances in a stack structure so clients can push/pop streams at will.  The stack is also maintained in thread-local storage, so different threads can re-direct individually.  This allows for two use cases:

1. Compilers can attach custom streams to outs()/errs() to intercept output from LLVM without needing to play with STDOUT/STDERR.
2. Compilers can receive LLVM output from different threads individually, instead of having all diagnostics dumped to a single stream.

Unit tests are included in the patch.


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-the-ability-to-assign-custom-streams-to-outs-err.patch
Type: application/octet-stream
Size: 7465 bytes
Desc: 0001-Add-the-ability-to-assign-custom-streams-to-outs-err.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120531/311c07c0/attachment.obj>


More information about the llvm-dev mailing list