aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-07-29 16:08:27 +0000
committerDavid Greene <greened@obbligato.org>2009-07-29 16:08:27 +0000
commiteb85728970c6152842577658ac2c5d2ff3a98b13 (patch)
tree38189f3cabe63140def293d3f53254c0cbd61059 /include
parent0a28d18cd47433eff31a12d9d721000f2d52489b (diff)
downloadexternal_llvm-eb85728970c6152842577658ac2c5d2ff3a98b13.zip
external_llvm-eb85728970c6152842577658ac2c5d2ff3a98b13.tar.gz
external_llvm-eb85728970c6152842577658ac2c5d2ff3a98b13.tar.bz2
Re-apply previous changes and improve column padding performance some more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/FormattedStream.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/include/llvm/Support/FormattedStream.h b/include/llvm/Support/FormattedStream.h
index 4b13ff2..8d6dca6 100644
--- a/include/llvm/Support/FormattedStream.h
+++ b/include/llvm/Support/FormattedStream.h
@@ -49,14 +49,21 @@ namespace llvm
///
bool DeleteStream;
- /// Column - The current output column of the stream. The column
- /// scheme is zero-based.
+ /// ColumnScanned - The current output column of the data that's
+ /// been flushed and the portion of the buffer that's been
+ /// scanned. The column scheme is zero-based.
///
- unsigned Column;
+ unsigned ColumnScanned;
+
+ /// Scanned - This points to one past the last character in the
+ /// buffer we've scanned.
+ ///
+ iterator Scanned;
virtual void write_impl(const char *Ptr, size_t Size) {
- ComputeColumn(Ptr, Size);
+ ComputeColumn();
TheStream->write(Ptr, Size);
+ Scanned = begin();
}
/// current_pos - Return the current position within the stream,
@@ -70,7 +77,7 @@ namespace llvm
/// ComputeColumn - Examine the current output and figure out
/// which column we end up in after output.
///
- void ComputeColumn(const char *Ptr, size_t Size);
+ void ComputeColumn();
public:
/// formatted_raw_ostream - Open the specified file for
@@ -84,13 +91,16 @@ namespace llvm
/// underneath it.
///
formatted_raw_ostream(raw_ostream &Stream, bool Delete = false)
- : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) {
+ : raw_ostream(), TheStream(0), DeleteStream(false), ColumnScanned(0) {
setStream(Stream, Delete);
}
explicit formatted_raw_ostream()
- : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) {}
+ : raw_ostream(), TheStream(0), DeleteStream(false), ColumnScanned(0) {
+ Scanned = begin();
+ }
~formatted_raw_ostream() {
+ flush();
if (DeleteStream)
delete TheStream;
}
@@ -110,6 +120,8 @@ namespace llvm
if (size_t BufferSize = TheStream->GetNumBytesInBuffer())
SetBufferSize(BufferSize);
TheStream->SetUnbuffered();
+
+ Scanned = begin();
}
/// PadToColumn - Align the output to some column number.