Changes in directory llvm/include/llvm/Support:
ConstantRange.h updated: 1.11 -> 1.12 Debug.h updated: 1.12 -> 1.13 Streams.h updated: 1.6 -> 1.7 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+11 -6) ConstantRange.h | 4 +--- Debug.h | 4 ++-- Streams.h | 9 ++++++++- 3 files changed, 11 insertions(+), 6 deletions(-) Index: llvm/include/llvm/Support/ConstantRange.h diff -u llvm/include/llvm/Support/ConstantRange.h:1.11 llvm/include/llvm/Support/ConstantRange.h:1.12 --- llvm/include/llvm/Support/ConstantRange.h:1.11 Wed Dec 6 19:30:31 2006 +++ llvm/include/llvm/Support/ConstantRange.h Sat Dec 16 23:15:12 2006 @@ -141,10 +141,8 @@ /// print - Print out the bounds to a stream... /// - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// dump - Allow printing from a debugger easily... /// Index: llvm/include/llvm/Support/Debug.h diff -u llvm/include/llvm/Support/Debug.h:1.12 llvm/include/llvm/Support/Debug.h:1.13 --- llvm/include/llvm/Support/Debug.h:1.12 Wed Dec 6 19:30:31 2006 +++ llvm/include/llvm/Support/Debug.h Sat Dec 16 23:15:12 2006 @@ -65,10 +65,10 @@ /// places the std::c* I/O streams into one .cpp file and relieves the whole /// program from having to have hundreds of static c'tor/d'tors for them. /// -OStream getErrorOutputStream(const char *DebugType); +OStream &getErrorOutputStream(const char *DebugType); #ifdef NDEBUG -#define DOUT NullStream +#define DOUT cnull #else #define DOUT getErrorOutputStream(DEBUG_TYPE) #endif Index: llvm/include/llvm/Support/Streams.h diff -u llvm/include/llvm/Support/Streams.h:1.6 llvm/include/llvm/Support/Streams.h:1.7 --- llvm/include/llvm/Support/Streams.h:1.6 Thu Dec 7 17:41:45 2006 +++ llvm/include/llvm/Support/Streams.h Sat Dec 16 23:15:12 2006 @@ -39,6 +39,11 @@ return *this; } +// inline BaseStream &operator << (std::ios &(*Func)(std::ios&)) { +// if (Stream) *Stream << Func; +// return *this; +// } + template <typename Ty> BaseStream &operator << (const Ty &Thing) { if (Stream) *Stream << Thing; @@ -51,6 +56,8 @@ return *this; } + operator StreamTy* () { return Stream; } + bool operator == (const StreamTy &S) { return &S == Stream; } bool operator != (const StreamTy &S) { return !(*this == S); } bool operator == (const BaseStream &S) { return S.Stream == Stream; } @@ -61,7 +68,7 @@ typedef BaseStream<std::istream> IStream; typedef BaseStream<std::stringstream> StringStream; - extern OStream NullStream; + extern OStream cnull; extern OStream cout; extern OStream cerr; extern IStream cin; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits