Rename BlockFrequency to BlockFrequencyInfo and MachineBlockFrequency to
[oota-llvm.git] / lib / Support / Debug.cpp
index 12b38c7ce70528ed6eea08fbf537990ba8145ac4..9fdb12ecfdcb13964d17571e674fd0df056e7472 100644 (file)
@@ -26,7 +26,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/circular_raw_ostream.h"
-#include "llvm/System/Signals.h"
+#include "llvm/Support/Signals.h"
 
 using namespace llvm;
 
@@ -51,12 +51,19 @@ DebugBufferSize("debug-buffer-size",
                 cl::init(0));
 
 static std::string CurrentDebugType;
-static struct DebugOnlyOpt {
+
+namespace {
+
+struct DebugOnlyOpt {
   void operator=(const std::string &Val) const {
     DebugFlag |= !Val.empty();
     CurrentDebugType = Val;
   }
-} DebugOnlyOptLoc;
+};
+
+}
+
+static DebugOnlyOpt DebugOnlyOptLoc;
 
 static cl::opt<DebugOnlyOpt, true, cl::parser<std::string> >
 DebugOnly("debug-only", cl::desc("Enable a specific type of debug output"),
@@ -64,8 +71,7 @@ DebugOnly("debug-only", cl::desc("Enable a specific type of debug output"),
           cl::location(DebugOnlyOptLoc), cl::ValueRequired);
 
 // Signal handlers - dump debug output on termination.
-static void debug_user_sig_handler(void *Cookie)
-{
+static void debug_user_sig_handler(void *Cookie) {
   // This is a bit sneaky.  Since this is under #ifndef NDEBUG, we
   // know that debug mode is enabled and dbgs() really is a
   // circular_raw_ostream.  If NDEBUG is defined, then dbgs() ==
@@ -105,7 +111,7 @@ raw_ostream &llvm::dbgs() {
         // force a debug dump.
         sys::AddSignalHandler(&debug_user_sig_handler, 0);
       // Otherwise we've already set the debug stream buffer size to
-      // zero, disabling buffering.
+      // zero, disabling buffering so it will output directly to errs().
     }
   } thestrm;
 
@@ -115,9 +121,9 @@ raw_ostream &llvm::dbgs() {
 #else
 // Avoid "has no symbols" warning.
 namespace llvm {
-  /// dbgs - Return dbgs().
+  /// dbgs - Return errs().
   raw_ostream &dbgs() {
-    return dbgs();
+    return errs();
   }
 }