[llvm-commits] [llvm] r78567 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/Support/IOManip.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Bill Wendling wendling at apple.com
Mon Aug 10 11:11:31 PDT 2009


Hi David,

> --- llvm/trunk/include/llvm/Support/IOManip.h (added)
> +++ llvm/trunk/include/llvm/Support/IOManip.h Mon Aug 10 11:38:07 2009
> @@ -0,0 +1,43 @@
> +//===----------------- IOManip.h - iostream manipulators --------- 
> *- C++ -*===//
> +//
> +//                     The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open  
> Source
> +// License. See LICENSE.TXT for details.
> +//
> +// 
> = 
> = 
> = 
> ----------------------------------------------------------------------= 
> ==//
> +//
> +// Manipulators to do special-purpose formatting.
> +//
> +// 
> = 
> = 
> = 
> ----------------------------------------------------------------------= 
> ==//
> +
> +namespace llvm {
> +  /// Indent - Insert spaces into the character output stream.  The
> +  /// "level" is multiplied by the "scale" to calculate the number of
> +  /// spaces to insert.  "level" can represent something like loop
> +  /// nesting level, for example.
> +  ///
> +  class Indent {
> +  public:
> +    explicit Indent(int lvl, int amt = 2)
> +        : level(lvl), scale(amt) {}
> +
> +    template<typename OStream>
> +    OStream &operator()(OStream &out) const {
> +      for(int i = 0; i < level*scale; ++i) {
> +        out << " ";
> +      }
> +      return out;
> +    }
> +

OStream is already a proper name in Support/Streams.h. This could lead  
to confusion, especially if you're #including Support/Debug.h before  
this. Could you rename the template argument?

-bw



More information about the llvm-commits mailing list