switch formattedstream to use raw_ostream::indent. This eliminates
authorChris Lattner <sabre@nondot.org>
Sat, 22 Aug 2009 23:16:09 +0000 (23:16 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 22 Aug 2009 23:16:09 +0000 (23:16 +0000)
the weird MAX_COLUMN_PAD limitation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79785 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/FormattedStream.h
lib/Support/FormattedStream.cpp

index 3a872058c9d82f601bedf369e1ba8c849b496ecc..768b8ed0eed9ff65d9da5cd23b9a85b024ed50ab 100644 (file)
@@ -33,11 +33,6 @@ namespace llvm
     ///
     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.
index 4e624275300eec0e7186cb48964fa6ec04b2eb80..70f2cfa6ae882cf0ca772679eaa49b73df9ebc32 100644 (file)
@@ -63,16 +63,7 @@ void formatted_raw_ostream::PadToColumn(unsigned NewCol) {
   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) {