[cfe-dev] using raw_ostream in ASTConsumers

Csaba Hruska csaba.hruska at gmail.com
Tue Aug 26 03:11:10 PDT 2008


Hi!
I've sent a patch what replaces std::ostream with llvm::raw_ostream.  What's
the status of its review ? I know it is not an important patch but i would
like to finish porting because i'd like to finish existing distcc clang code
to be ready for merge sooner then later.

Cheers,
Csaba

2008/8/23 Chris Lattner <clattner at apple.com>

> On Aug 23, 2008, at 11:35 AM, Chris Lattner wrote:
>
>> I've found these problems:
>>> - raw_stream is currently not supports pointer printing. << (void*)X
>>>
>>
>> This should be easy to add, just add a method to raw_stream?
>>
>
> I didn't add this, can you add it?
>
>  - not supports field width like: << std::setw(3) << ... (this is in
>>> file: CFG.cpp line 1485)
>>> - not supports hexa printing like: <<std::hex << value (this is in
>>> file: StmtPrinter.cpp line 550)
>>>
>>
>> Adding a full set of formatting is a non-trival job, and we don't want
>> to follow the lead of iostreams.  I'll see if I can hack something in
>> quickly.
>>
>
> Okay, you can now do stuff like this:
>
> OS << "whatever" << format("%4.3f some hex thing 0x%X", mydouble, 255) << "
> blah";
>
> This is efficient (no temporary strings etc), and you can use any
> (portable) printf formatting without penalty.
>
> -Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080826/c934bf88/attachment.html>


More information about the cfe-dev mailing list