aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Debug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Debug.cpp')
-rw-r--r--lib/Support/Debug.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Support/Debug.cpp b/lib/Support/Debug.cpp
index 394d9c1109..cbf12c7c0d 100644
--- a/lib/Support/Debug.cpp
+++ b/lib/Support/Debug.cpp
@@ -25,6 +25,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/CommandLine.h"
+#include <iostream>
using namespace llvm;
bool llvm::DebugFlag; // DebugFlag - Exported boolean set by the -debug option
@@ -63,3 +64,14 @@ bool llvm::isCurrentDebugType(const char *DebugType) {
return false;
#endif
}
+
+// 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.
+//
+llvm_ostream llvm::getErrorOutputStream(const char *DebugType) {
+ if (DebugFlag && isCurrentDebugType(DebugType))
+ return llvm_ostream(std::cerr);
+ else
+ return llvm_ostream();
+}