From fcf17a30961ac3dfee893c323f7b9ae5fe012957 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 3 Jan 2007 22:37:27 +0000 Subject: [PATCH] The previous implementation of LLVM Streams wasn't removing symbols. This one should. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32845 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/Debug.h | 2 +- include/llvm/Support/Streams.h | 6 ------ lib/Support/Debug.cpp | 3 ++- lib/Support/Streams.cpp | 1 - 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/include/llvm/Support/Debug.h b/include/llvm/Support/Debug.h index 627d088eb05..437e57ea073 100644 --- a/include/llvm/Support/Debug.h +++ b/include/llvm/Support/Debug.h @@ -68,7 +68,7 @@ bool isCurrentDebugType(const char *Type); OStream &getErrorOutputStream(const char *DebugType); #ifdef NDEBUG -#define DOUT cnull +#define DOUT OStream(0) #else #define DOUT getErrorOutputStream(DEBUG_TYPE) #endif diff --git a/include/llvm/Support/Streams.h b/include/llvm/Support/Streams.h index f141c92a9fe..4e1e4f3a26c 100644 --- a/include/llvm/Support/Streams.h +++ b/include/llvm/Support/Streams.h @@ -39,11 +39,6 @@ namespace llvm { return *this; } -// inline BaseStream &operator << (std::ios &(*Func)(std::ios&)) { -// if (Stream) *Stream << Func; -// return *this; -// } - template BaseStream &operator << (const Ty &Thing) { if (Stream) *Stream << Thing; @@ -68,7 +63,6 @@ namespace llvm { typedef BaseStream IStream; typedef BaseStream StringStream; - extern OStream cnull; extern OStream cout; extern OStream cerr; extern IStream cin; diff --git a/lib/Support/Debug.cpp b/lib/Support/Debug.cpp index 6e67ed8f673..c5b6fa2bf44 100644 --- a/lib/Support/Debug.cpp +++ b/lib/Support/Debug.cpp @@ -69,8 +69,9 @@ bool llvm::isCurrentDebugType(const char *DebugType) { // program from having to have hundreds of static c'tor/d'tors for them. // OStream &llvm::getErrorOutputStream(const char *DebugType) { + static OStream cnoout(0); if (DebugFlag && isCurrentDebugType(DebugType)) return cerr; else - return cnull; + return cnoout; } diff --git a/lib/Support/Streams.cpp b/lib/Support/Streams.cpp index 3d20e9aea35..433f6b42418 100644 --- a/lib/Support/Streams.cpp +++ b/lib/Support/Streams.cpp @@ -16,7 +16,6 @@ #include using namespace llvm; -OStream llvm::cnull; OStream llvm::cout(std::cout); OStream llvm::cerr(std::cerr); IStream llvm::cin(std::cin); -- 2.34.1