[llvm] r234535 - Simplify use of formatted_raw_ostream.

Rafael Espíndola rafael.espindola at gmail.com
Wed Jun 10 14:16:33 PDT 2015


On 8 June 2015 at 19:00, Mehdi Amini <mehdi.amini at apple.com> wrote:
> Hi Rafael,
>
> This change introduce a layer (formatted_raw_ostream) between the stream provided by the user to addPassesToEmitFile() and the AsmStreamer.
>
> The problem is that the client does not have any handle to the formatted_raw_ostream, and cannot flush it. As a result the only way to be sure to get the full assembly out of the streamer is to tear down the MCAsmStreamer (which means basically tearing down everything since it is owned ultimately by the PassManager).
>
> I’m not sure what is the right fix, maybe formatted_raw_ostream should not be buffered and should leave the buffering to the underlying stream. The current behavior is the opposite:
>
>     // This formatted_raw_ostream inherits from raw_ostream, so it'll do its
>     // own buffering, and it doesn't need or want TheStream to do another
>     // layer of buffering underneath. Resize the buffer to what TheStream
>     // had been using, and tell TheStream not to do its own buffering.

Interesting idea. I wonder why we went with disabling the buffer of
the passed stream. I will take a look at git log and play with the
idea of flipping it.

Thanks for the bug report.

Cheers,
Rafael




More information about the llvm-commits mailing list