[llvm-commits] [llvm] r76910 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp
Chris Lattner
clattner at apple.com
Thu Jul 23 16:44:47 PDT 2009
On Jul 23, 2009, at 4:21 PM, David Greene wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=76910&view=rev
> Log:
> Write space padding as one string to speed up comment printing.
Hi David,
> + // Keep a buffer of spaces handy to speed up processing.
> + static char Spaces[MAX_COLUMN_PAD];
> + static bool Initialized = false;
> + if (!Initialized) {
This won't work because it isn't thread safe. Why not just use:
const char *Spaces = " .... ";
write(Spaces, num);
-Chris
> + std::fill_n(Spaces, MAX_COLUMN_PAD, ' '),
> + Initialized = true;
> + }
> +
> + assert(num < MAX_COLUMN_PAD && "Unexpectedly large column
> padding");
> +
> + write(Spaces, num);
> }
>
> /// fouts() - This returns a reference to a formatted_raw_ostream for
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list