namespace llvm
{
- class formatted_tool_output_file;
-
/// formatted_raw_ostream - Formatted raw_fd_ostream to handle
/// asm-specific constructs.
///
class formatted_raw_ostream : public raw_ostream {
- friend class formatted_tool_output_file;
-
public:
/// DELETE_STREAM - Tell the destructor to delete the held stream.
///
///
const char *Scanned;
- virtual void write_impl(const char *Ptr, size_t Size);
+ virtual void write_impl(const char *Ptr, size_t Size) LLVM_OVERRIDE;
/// current_pos - Return the current position within the stream,
/// not counting the bytes currently in the buffer.
- virtual uint64_t current_pos() const {
- // This has the same effect as calling TheStream.current_pos(),
- // but that interface is private.
- return TheStream->tell() - TheStream->GetNumBytesInBuffer();
+ virtual uint64_t current_pos() const LLVM_OVERRIDE {
+ // Our current position in the stream is all the contents which have been
+ // written to the underlying stream (*not* the current position of the
+ // underlying stream).
+ return TheStream->tell();
}
/// ComputeColumn - Examine the given output buffer and figure out which
}
};
- /// formatted_tool_output_file - This is a subclass of formatted_raw_ostream
- /// for use when the underlying stream is a tool_output_file. It exposes
- /// keep() and several other member functions.
- class formatted_tool_output_file : public formatted_raw_ostream {
- private:
- tool_output_file &get_tool_output_file() const {
- return *static_cast<tool_output_file *>(TheStream);
- }
-
- public:
- formatted_tool_output_file(tool_output_file &Stream, bool Delete = false)
- : formatted_raw_ostream(Stream, Delete) {}
-
- formatted_tool_output_file() {}
-
- ~formatted_tool_output_file();
-
- void setStream(tool_output_file &Stream, bool Delete = false) {
- return formatted_raw_ostream::setStream(Stream, Delete);
- }
-
- void keep() { return get_tool_output_file().keep(); }
- bool has_error() const { return get_tool_output_file().has_error(); }
- void clear_error() { return get_tool_output_file().clear_error(); }
- void close() { return get_tool_output_file().close(); }
- };
-
/// fouts() - This returns a reference to a formatted_raw_ostream for
/// standard output. Use it like: fouts() << "foo" << "bar";
formatted_raw_ostream &fouts();