24struct CreateUseColor {
28 cl::desc(
"Use colors in output (default=autodetect)"),
45 : OS(OS), Mode(Mode) {
102 bool DisableColors) {
104 OS << Prefix <<
": ";
112 bool DisableColors) {
114 OS << Prefix <<
": ";
122 bool DisableColors) {
124 OS << Prefix <<
": ";
138 return AutoDetectFunction(OS);
176 AutoDetectFunction = NewAutoDetectFunction;
static bool DefaultAutoDetectFunction(const raw_ostream &OS)
static ManagedStatic< cl::opt< cl::boolOrDefault >, CreateUseColor > UseColor
Base class for error info classes.
Lightweight error class with error context and mandatory checking.
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
StringRef - Represent a constant reference to a string, i.e.
LLVM_ABI WithColor & changeColor(raw_ostream::Colors Color, bool Bold=false, bool BG=false)
Change the color of text that will be output from this point forward.
static LLVM_ABI void defaultWarningHandler(Error Warning)
Implement default handling for Warning.
LLVM_CTOR_NODISCARD LLVM_ABI WithColor(raw_ostream &OS, HighlightColor S, ColorMode Mode=ColorMode::Auto)
To be used like this: WithColor(OS, HighlightColor::String) << "text";.
LLVM_ABI bool colorsEnabled()
Determine whether colors are displayed.
static LLVM_ABI raw_ostream & warning()
Convenience method for printing "warning: " to stderr.
static LLVM_ABI raw_ostream & error()
Convenience method for printing "error: " to stderr.
bool(*)(const raw_ostream &OS) AutoDetectFunctionType
LLVM_ABI WithColor & resetColor()
Reset the colors to terminal defaults.
static LLVM_ABI void defaultErrorHandler(Error Err)
Implement default handling for Error.
static LLVM_ABI raw_ostream & note()
Convenience method for printing "note: " to stderr.
static LLVM_ABI AutoDetectFunctionType defaultAutoDetectFunction()
Retrieve the default color auto detection function.
static LLVM_ABI void setAutoDetectFunction(AutoDetectFunctionType NewAutoDetectFunction)
Change the global auto detection function.
static LLVM_ABI raw_ostream & remark()
Convenience method for printing "remark: " to stderr.
This class implements an extremely fast bulk output stream that can only output to a stream.
static constexpr Colors BLACK
static constexpr Colors GREEN
static constexpr Colors BLUE
static constexpr Colors RED
static constexpr Colors MAGENTA
static constexpr Colors YELLOW
static constexpr Colors CYAN
virtual bool has_colors() const
This function determines if this stream is displayed and supports colors.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
void initWithColorOptions()
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
LLVM_ABI cl::OptionCategory & getColorCategory()
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ Auto
Determine whether to use color based on the command line argument and the raw_ostream.