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

Chris Lattner sabre at nondot.org
Sat Aug 22 16:16:09 PDT 2009


Author: lattner
Date: Sat Aug 22 18:16:09 2009
New Revision: 79785

URL: http://llvm.org/viewvc/llvm-project?rev=79785&view=rev
Log:
switch formattedstream to use raw_ostream::indent.  This eliminates
the weird MAX_COLUMN_PAD limitation.

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=79785&r1=79784&r2=79785&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/FormattedStream.h (original)
+++ llvm/trunk/include/llvm/Support/FormattedStream.h Sat Aug 22 18:16:09 2009
@@ -33,11 +33,6 @@
     ///
     const static bool PRESERVE_STREAM = false;
 
-    /// MAX_COLUMN_PAD - This is the maximum column padding we ever
-    /// expect to see.
-    ///
-    const static unsigned MAX_COLUMN_PAD = 100;
-
   private:
     /// TheStream - The real stream we output to. We set it to be
     /// unbuffered, since we're already doing our own buffering.

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

==============================================================================
--- llvm/trunk/lib/Support/FormattedStream.cpp (original)
+++ llvm/trunk/lib/Support/FormattedStream.cpp Sat Aug 22 18:16:09 2009
@@ -63,16 +63,7 @@
   ComputeColumn(getBufferStart(), GetNumBytesInBuffer());
 
   // Output spaces until we reach the desired column.
-  unsigned num = NewCol - ColumnScanned;
-  if (NewCol < ColumnScanned || num < 1)
-    num = 1;
-
-  // Keep a buffer of spaces handy to speed up processing.
-  const char *Spaces = "                                                      "
-    "                                                                         ";
-
-  assert(num < MAX_COLUMN_PAD && "Unexpectedly large column padding");
-  write(Spaces, num);
+  indent(std::max(int(NewCol - ColumnScanned), 1));
 }
 
 void formatted_raw_ostream::write_impl(const char *Ptr, size_t Size) {





More information about the llvm-commits mailing list