diff options
Diffstat (limited to 'include/llvm/Support')
-rw-r--r-- | include/llvm/Support/ConstantRange.h | 4 | ||||
-rw-r--r-- | include/llvm/Support/Debug.h | 4 | ||||
-rw-r--r-- | include/llvm/Support/Streams.h | 9 |
3 files changed, 11 insertions, 6 deletions
diff --git a/include/llvm/Support/ConstantRange.h b/include/llvm/Support/ConstantRange.h index 6866ffe..f50e979 100644 --- a/include/llvm/Support/ConstantRange.h +++ b/include/llvm/Support/ConstantRange.h @@ -141,10 +141,8 @@ class ConstantRange { /// 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... /// diff --git a/include/llvm/Support/Debug.h b/include/llvm/Support/Debug.h index 09878b9..627d088 100644 --- a/include/llvm/Support/Debug.h +++ b/include/llvm/Support/Debug.h @@ -65,10 +65,10 @@ bool isCurrentDebugType(const char *Type); /// 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 diff --git a/include/llvm/Support/Streams.h b/include/llvm/Support/Streams.h index 82ffeeb..f141c92 100644 --- a/include/llvm/Support/Streams.h +++ b/include/llvm/Support/Streams.h @@ -39,6 +39,11 @@ namespace llvm { 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 @@ namespace llvm { 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 @@ namespace llvm { 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; |