LLVM  7.0.0
Public Member Functions | Static Public Member Functions | List of all members
llvm::WithColor Class Reference

An RAII object that temporarily switches an output stream to a specific color. More...

#include "llvm/Support/WithColor.h"

Public Member Functions

 WithColor (raw_ostream &OS, HighlightColor S)
 To be used like this: WithColor(OS, HighlightColor::String) << "text";. More...
 
 ~WithColor ()
 
raw_ostream & get ()
 
 operator raw_ostream & ()
 

Static Public Member Functions

static raw_ostream & error ()
 Convenience method for printing "error: " to stderr. More...
 
static raw_ostream & warning ()
 Convenience method for printing "warning: " to stderr. More...
 
static raw_ostream & note ()
 Convenience method for printing "note: " to stderr. More...
 
static raw_ostream & error (raw_ostream &OS, StringRef Prefix="")
 Convenience method for printing "error: " to the given stream. More...
 
static raw_ostream & warning (raw_ostream &OS, StringRef Prefix="")
 Convenience method for printing "warning: " to the given stream. More...
 
static raw_ostream & note (raw_ostream &OS, StringRef Prefix="")
 Convenience method for printing "note: " to the given stream. More...
 

Detailed Description

An RAII object that temporarily switches an output stream to a specific color.

Definition at line 37 of file WithColor.h.

Constructor & Destructor Documentation

◆ WithColor()

WithColor::WithColor ( raw_ostream &  OS,
HighlightColor  S 
)

◆ ~WithColor()

WithColor::~WithColor ( )

Definition at line 87 of file WithColor.cpp.

References llvm::raw_ostream::resetColor().

Member Function Documentation

◆ error() [1/2]

raw_ostream & WithColor::error ( )
static

◆ error() [2/2]

raw_ostream & WithColor::error ( raw_ostream &  OS,
StringRef  Prefix = "" 
)
static

Convenience method for printing "error: " to the given stream.

Definition at line 69 of file WithColor.cpp.

References llvm::StringRef::empty(), llvm::Error, and WithColor().

◆ get()

raw_ostream& llvm::WithColor::get ( )
inline

◆ note() [1/2]

raw_ostream & WithColor::note ( )
static

Convenience method for printing "note: " to stderr.

Definition at line 67 of file WithColor.cpp.

References llvm::errs().

Referenced by llvm::DWARFVerifier::handleAccelTables().

◆ note() [2/2]

raw_ostream & WithColor::note ( raw_ostream &  OS,
StringRef  Prefix = "" 
)
static

Convenience method for printing "note: " to the given stream.

Definition at line 81 of file WithColor.cpp.

References llvm::StringRef::empty(), llvm::Note, and WithColor().

◆ operator raw_ostream &()

llvm::WithColor::operator raw_ostream & ( )
inline

Definition at line 48 of file WithColor.h.

References error, and llvm::cl::Prefix.

◆ warning() [1/2]

raw_ostream & WithColor::warning ( )
static

Convenience method for printing "warning: " to stderr.

Definition at line 65 of file WithColor.cpp.

References llvm::errs().

Referenced by dumpAddrSection(), llvm::DWARFUnit::getCompilationDir(), llvm::DWARFVerifier::handleAccelTables(), and llvm::PrintWarning().

◆ warning() [2/2]

raw_ostream & WithColor::warning ( raw_ostream &  OS,
StringRef  Prefix = "" 
)
static

Convenience method for printing "warning: " to the given stream.

Definition at line 75 of file WithColor.cpp.

References llvm::StringRef::empty(), llvm::Warning, and WithColor().


The documentation for this class was generated from the following files: