[Support] Add optional prefix to convenience helpers in WithColor.

Several tools prefix the error/warning/note output with the name of the
tool. One such tool is LLD for example. This commit adds as an optional
'Prefix' argument to the convenience helpers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330526 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jonas Devlieghere
2018-04-21 21:36:11 +00:00
parent 6d70778ed2
commit 52107f0189
2 changed files with 11 additions and 6 deletions
+6 -3
View File
@@ -65,15 +65,18 @@ raw_ostream &WithColor::warning() { return warning(errs()); }
raw_ostream &WithColor::note() { return note(errs()); }
raw_ostream &WithColor::error(raw_ostream &OS) {
raw_ostream &WithColor::error(raw_ostream &OS, StringRef Prefix) {
OS << Prefix;
return WithColor(OS, HighlightColor::Error).get() << "error: ";
}
raw_ostream &WithColor::warning(raw_ostream &OS) {
raw_ostream &WithColor::warning(raw_ostream &OS, StringRef Prefix) {
OS << Prefix;
return WithColor(OS, HighlightColor::Warning).get() << "warning: ";
}
raw_ostream &WithColor::note(raw_ostream &OS) {
raw_ostream &WithColor::note(raw_ostream &OS, StringRef Prefix) {
OS << Prefix;
return WithColor(OS, HighlightColor::Note).get() << "note: ";
}