diff options
author | Bill Wendling <isanbard@gmail.com> | 2006-11-17 00:49:12 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2006-11-17 00:49:12 +0000 |
commit | 1ea783f13a83ce9402f543fbc2367d125dc26f91 (patch) | |
tree | 3bde233e2cdf48097b3d860b2d6e3f1d1f83dff9 /lib/Support/Debug.cpp | |
parent | e28a12a3b8d42543bb291d5aacf0b65a95dd3653 (diff) | |
download | external_llvm-1ea783f13a83ce9402f543fbc2367d125dc26f91.zip external_llvm-1ea783f13a83ce9402f543fbc2367d125dc26f91.tar.gz external_llvm-1ea783f13a83ce9402f543fbc2367d125dc26f91.tar.bz2 |
Added "DOUT" macro. This is used as a replacement for the std::cerr
stream. It centralizes the use of std::cerr so that static c'tor/d'tors
aren't scattered around all over the place. The way to use it is like this:
DOUT << "This is a status line: " << Var << "\n";
If "-debug" is specified, it will print. Otherwise, it'll not print. If
NDEBUG is defined, the DOUT does nothing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31798 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Debug.cpp')
-rw-r--r-- | lib/Support/Debug.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Support/Debug.cpp b/lib/Support/Debug.cpp index 394d9c1..cbf12c7 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(); +} |