mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-26 09:18:56 +00:00
eliminate DOUT and make Debug.h not include Streams.h anymore, woo!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -26,8 +26,6 @@
|
|||||||
#ifndef LLVM_SUPPORT_DEBUG_H
|
#ifndef LLVM_SUPPORT_DEBUG_H
|
||||||
#define LLVM_SUPPORT_DEBUG_H
|
#define LLVM_SUPPORT_DEBUG_H
|
||||||
|
|
||||||
#include "llvm/Support/Streams.h"
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
// DebugFlag - This boolean is set to true if the '-debug' command line option
|
// DebugFlag - This boolean is set to true if the '-debug' command line option
|
||||||
@@ -40,7 +38,11 @@ extern bool DebugFlag;
|
|||||||
// specified on the command line, or if none was specified on the command line
|
// specified on the command line, or if none was specified on the command line
|
||||||
// with the -debug-only=X option.
|
// with the -debug-only=X option.
|
||||||
//
|
//
|
||||||
|
#ifndef NDEBUG
|
||||||
bool isCurrentDebugType(const char *Type);
|
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
|
// 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
|
// information. In the '-debug' option is specified on the commandline, and if
|
||||||
@@ -73,23 +75,6 @@ bool isCurrentDebugType(const char *Type);
|
|||||||
|
|
||||||
#define DEBUG(X) DEBUG_WITH_TYPE(DEBUG_TYPE, X)
|
#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
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -29,7 +29,6 @@ using namespace llvm;
|
|||||||
|
|
||||||
bool llvm::DebugFlag; // DebugFlag - Exported boolean set by the -debug option
|
bool llvm::DebugFlag; // DebugFlag - Exported boolean set by the -debug option
|
||||||
|
|
||||||
namespace {
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// -debug - Command line option to enable the DEBUG statements in the passes.
|
// -debug - Command line option to enable the DEBUG statements in the passes.
|
||||||
// This flag may only be enabled in debug builds.
|
// This flag may only be enabled in debug builds.
|
||||||
@@ -50,7 +49,6 @@ namespace {
|
|||||||
cl::Hidden, cl::value_desc("debug string"),
|
cl::Hidden, cl::value_desc("debug string"),
|
||||||
cl::location(DebugOnlyOptLoc), cl::ValueRequired);
|
cl::location(DebugOnlyOptLoc), cl::ValueRequired);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
// isCurrentDebugType - Return true if the specified string is the debug type
|
// 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
|
// specified on the command line, or if none was specified on the command line
|
||||||
@@ -63,23 +61,3 @@ bool llvm::isCurrentDebugType(const char *DebugType) {
|
|||||||
return false;
|
return false;
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user