summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-15 02:17:50 +0000
committerChris Lattner <sabre@nondot.org>2010-02-15 02:17:50 +0000
commitefbdaa6463c8febe9cbfdd6d39f3a9ba18773427 (patch)
tree5a0465fe2dbb6abb03265585c0d2a6e753643c2d
parent3da6e09de53d1f50ceed308de855cdce1a54cb81 (diff)
downloadllvm-efbdaa6463c8febe9cbfdd6d39f3a9ba18773427.tar.gz
llvm-efbdaa6463c8febe9cbfdd6d39f3a9ba18773427.tar.bz2
llvm-efbdaa6463c8febe9cbfdd6d39f3a9ba18773427.tar.xz
make PadToColumn return the stream so you can use:
OS.PadToColumn(42) << "foo"; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96208 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/FormattedStream.h2
-rw-r--r--lib/Support/FormattedStream.cpp3
2 files changed, 3 insertions, 2 deletions
diff --git a/include/llvm/Support/FormattedStream.h b/include/llvm/Support/FormattedStream.h
index af546f0535..58a24bd2e3 100644
--- a/include/llvm/Support/FormattedStream.h
+++ b/include/llvm/Support/FormattedStream.h
@@ -119,7 +119,7 @@ namespace llvm
/// space.
///
/// \param NewCol - The column to move to.
- void PadToColumn(unsigned NewCol);
+ formatted_raw_ostream &PadToColumn(unsigned NewCol);
private:
void releaseStream() {
diff --git a/lib/Support/FormattedStream.cpp b/lib/Support/FormattedStream.cpp
index 9ab3666340..39b6cb3f1f 100644
--- a/lib/Support/FormattedStream.cpp
+++ b/lib/Support/FormattedStream.cpp
@@ -59,12 +59,13 @@ void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t Size) {
/// \param MinPad - The minimum space to give after the most recent
/// I/O, even if the current column + minpad > newcol.
///
-void formatted_raw_ostream::PadToColumn(unsigned NewCol) {
+formatted_raw_ostream &formatted_raw_ostream::PadToColumn(unsigned NewCol) {
// Figure out what's in the buffer and add it to the column count.
ComputeColumn(getBufferStart(), GetNumBytesInBuffer());
// Output spaces until we reach the desired column.
indent(std::max(int(NewCol - ColumnScanned), 1));
+ return *this;
}
void formatted_raw_ostream::write_impl(const char *Ptr, size_t Size) {