Hide the DOUT static variable behind a function interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76425 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/Support/Debug.h b/include/llvm/Support/Debug.h
index 0ebed20..489a076 100644
--- a/include/llvm/Support/Debug.h
+++ b/include/llvm/Support/Debug.h
@@ -61,6 +61,11 @@
   do { if (DebugFlag && isCurrentDebugType(DEBUG_TYPE)) { X; } } while (0)
 #endif
 
+/// 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.
@@ -68,8 +73,7 @@
 OStream &getErrorOutputStream(const char *DebugType);
 
 #ifdef NDEBUG
-static llvm::OStream NullStream(0);
-#define DOUT llvm::NullStream
+#define DOUT llvm::getNullOutputStream()
 #else
 #define DOUT llvm::getErrorOutputStream(DEBUG_TYPE)
 #endif
diff --git a/lib/Support/Debug.cpp b/lib/Support/Debug.cpp
index a09cddf..b6beddb 100644
--- a/lib/Support/Debug.cpp
+++ b/lib/Support/Debug.cpp
@@ -64,6 +64,14 @@
 #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.