[LLVMdev] std::cout << *MyModule does not work anymore

Chris Lattner clattner at apple.com
Mon Aug 24 23:30:35 PDT 2009


On Aug 24, 2009, at 8:04 PM, Óscar Fuentes wrote:
> However, when LLVM is
> just another library on an application (something that I hope often
> happens thanks to the great JIT it provides) having to learn the  
> quirks
> and kinks of something that pretends to replace a common functionality
> of the language's standard library *plus* integrating it into the
> existing code can be a real burden.

Right, this is exactly why we have raw_os_ostream.  If you have an  
std::ostream, you can can make LLVM output to it by using  
raw_os_ostream.  This way you get the internal performance wins in  
llvm plus the compatibility with std::ostream.  Bonus, it should  
faster than writing to std::ostream directly.

> Maybe there was a solution that was okay for those concerned with  
> fast &
> lightweight executables and for the others who care most about
> consistency and code stability. I would appreciate if this changes are
> discussed before applying them on the future (maybe I missed the
> thread), flagging the subject with something that indicates that the
> outcome of the discussion may break existing code.

raw_ostream has been a long time coming, it was started in 2008-08-16  
18:35:29.  The coding standards doc has *long* had wording that  
<iostream> (in particular) is evil.

-Chris



More information about the llvm-dev mailing list