[llvm-commits] [llvm] r96208 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp

Chris Lattner sabre at nondot.org
Sun Feb 14 18:17:50 PST 2010


Author: lattner
Date: Sun Feb 14 20:17:50 2010
New Revision: 96208

URL: http://llvm.org/viewvc/llvm-project?rev=96208&view=rev
Log:
make PadToColumn return the stream so you can use:
 OS.PadToColumn(42) << "foo";


Modified:
    llvm/trunk/include/llvm/Support/FormattedStream.h
    llvm/trunk/lib/Support/FormattedStream.cpp

Modified: llvm/trunk/include/llvm/Support/FormattedStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=96208&r1=96207&r2=96208&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/FormattedStream.h (original)
+++ llvm/trunk/include/llvm/Support/FormattedStream.h Sun Feb 14 20:17:50 2010
@@ -119,7 +119,7 @@
     /// space.
     ///
     /// \param NewCol - The column to move to.
-    void PadToColumn(unsigned NewCol);
+    formatted_raw_ostream &PadToColumn(unsigned NewCol);
 
   private:
     void releaseStream() {

Modified: llvm/trunk/lib/Support/FormattedStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FormattedStream.cpp?rev=96208&r1=96207&r2=96208&view=diff

==============================================================================
--- llvm/trunk/lib/Support/FormattedStream.cpp (original)
+++ llvm/trunk/lib/Support/FormattedStream.cpp Sun Feb 14 20:17:50 2010
@@ -59,12 +59,13 @@
 /// \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) {





More information about the llvm-commits mailing list