From a36b81d64f90f7cc7c946080d317322c3f4e3a0f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 23 Aug 2009 07:05:39 +0000 Subject: eliminate DOUT and make Debug.h not include Streams.h anymore, woo! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79835 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/Debug.cpp | 58 ++++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 40 deletions(-) (limited to 'lib/Support/Debug.cpp') diff --git a/lib/Support/Debug.cpp b/lib/Support/Debug.cpp index b6beddb369..806a6559df 100644 --- a/lib/Support/Debug.cpp +++ b/lib/Support/Debug.cpp @@ -29,28 +29,26 @@ using namespace llvm; bool llvm::DebugFlag; // DebugFlag - Exported boolean set by the -debug option -namespace { #ifndef NDEBUG - // -debug - Command line option to enable the DEBUG statements in the passes. - // This flag may only be enabled in debug builds. - static cl::opt - Debug("debug", cl::desc("Enable debug output"), cl::Hidden, - cl::location(DebugFlag)); - - static std::string CurrentDebugType; - static struct DebugOnlyOpt { - void operator=(const std::string &Val) const { - DebugFlag |= !Val.empty(); - CurrentDebugType = Val; - } - } DebugOnlyOptLoc; - - static cl::opt > - DebugOnly("debug-only", cl::desc("Enable a specific type of debug output"), - cl::Hidden, cl::value_desc("debug string"), - cl::location(DebugOnlyOptLoc), cl::ValueRequired); +// -debug - Command line option to enable the DEBUG statements in the passes. +// This flag may only be enabled in debug builds. +static cl::opt +Debug("debug", cl::desc("Enable debug output"), cl::Hidden, + cl::location(DebugFlag)); + +static std::string CurrentDebugType; +static struct DebugOnlyOpt { + void operator=(const std::string &Val) const { + DebugFlag |= !Val.empty(); + CurrentDebugType = Val; + } +} DebugOnlyOptLoc; + +static cl::opt > +DebugOnly("debug-only", cl::desc("Enable a specific type of debug output"), + cl::Hidden, cl::value_desc("debug string"), + cl::location(DebugOnlyOptLoc), cl::ValueRequired); #endif -} // isCurrentDebugType - Return true if the specified string is the debug type // specified on the command line, or if none was specified on the command line @@ -63,23 +61,3 @@ bool llvm::isCurrentDebugType(const char *DebugType) { return false; #endif } - -/// getNullOutputStream - Return a null string that does not output -/// anything. This hides the static variable from other modules. -/// -OStream &llvm::getNullOutputStream() { - static llvm::OStream NullStream(0); - return NullStream; -} - -// getErrorOutputStream - Returns the error output stream (std::cerr). This -// 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 &llvm::getErrorOutputStream(const char *DebugType) { - static OStream cnoout(0); - if (DebugFlag && isCurrentDebugType(DebugType)) - return cerr; - else - return cnoout; -} -- cgit v1.2.3