mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
[Support] Add convenience functions to WithColor. NFC.
Create convenience functions for printing error, warning and note to stdout. Previously we had similar functions being used in dsymutil, but given that this pattern is so common it makes sense to make it available globally. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330091 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -59,6 +59,18 @@ WithColor::WithColor(raw_ostream &OS, HighlightColor Color) : OS(OS) {
|
||||
}
|
||||
}
|
||||
|
||||
raw_ostream &WithColor::error() {
|
||||
return WithColor(errs(), HighlightColor::Error).get() << "error: ";
|
||||
}
|
||||
|
||||
raw_ostream &WithColor::warning() {
|
||||
return WithColor(errs(), HighlightColor::Warning).get() << "warning: ";
|
||||
}
|
||||
|
||||
raw_ostream &WithColor::note() {
|
||||
return WithColor(errs(), HighlightColor::Note).get() << "note: ";
|
||||
}
|
||||
|
||||
WithColor::~WithColor() {
|
||||
if (colorsEnabled(OS))
|
||||
OS.resetColor();
|
||||
|
||||
Reference in New Issue
Block a user