[llvm-commits] [llvm] r79835 - in /llvm/trunk: include/llvm/Support/Debug.h lib/Support/Debug.cpp

Chris Lattner sabre at nondot.org
Sun Aug 23 00:05:39 PDT 2009


Author: lattner
Date: Sun Aug 23 02:05:39 2009
New Revision: 79835

URL: http://llvm.org/viewvc/llvm-project?rev=79835&view=rev
Log:
eliminate DOUT and make Debug.h not include Streams.h anymore, woo!

Modified:
    llvm/trunk/include/llvm/Support/Debug.h
    llvm/trunk/lib/Support/Debug.cpp

Modified: llvm/trunk/include/llvm/Support/Debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Debug.h?rev=79835&r1=79834&r2=79835&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Debug.h (original)
+++ llvm/trunk/include/llvm/Support/Debug.h Sun Aug 23 02:05:39 2009
@@ -26,8 +26,6 @@
 #ifndef LLVM_SUPPORT_DEBUG_H
 #define LLVM_SUPPORT_DEBUG_H
 
-#include "llvm/Support/Streams.h"
-
 namespace llvm {
 
 // DebugFlag - This boolean is set to true if the '-debug' command line option
@@ -40,7 +38,11 @@
 // specified on the command line, or if none was specified on the command line
 // with the -debug-only=X option.
 //
+#ifndef NDEBUG
 bool isCurrentDebugType(const char *Type);
+#else
+#define isCurrentDebugType(X) (false)
+#endif
 
 // DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug
 // information.  In the '-debug' option is specified on the commandline, and if
@@ -72,24 +74,7 @@
 #endif
 
 #define DEBUG(X) DEBUG_WITH_TYPE(DEBUG_TYPE, X)
-
-/// getNullOutputStream - Return a null string that does not output
-/// anything.  This hides the static variable from other modules.
-///
-OStream &getNullOutputStream();
-
-/// 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 &getErrorOutputStream(const char *DebugType);
-
-#ifdef NDEBUG
-#define DOUT llvm::getNullOutputStream()
-#else
-#define DOUT llvm::getErrorOutputStream(DEBUG_TYPE)
-#endif
-
+  
 } // End llvm namespace
 
 #endif

Modified: llvm/trunk/lib/Support/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Debug.cpp?rev=79835&r1=79834&r2=79835&view=diff

==============================================================================
--- llvm/trunk/lib/Support/Debug.cpp (original)
+++ llvm/trunk/lib/Support/Debug.cpp Sun Aug 23 02:05:39 2009
@@ -29,28 +29,26 @@
 
 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<bool, true>
-  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<DebugOnlyOpt, true, cl::parser<std::string> >
-  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<bool, true>
+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<DebugOnlyOpt, true, cl::parser<std::string> >
+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 @@
   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;
-}





More information about the llvm-commits mailing list