[Support] Fix prefix logic in WithColor.

When a prefix is passed, we need to print a colon a space after it, not
just the prefix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330535 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jonas Devlieghere 2018-04-22 08:01:01 +00:00
parent c215743929
commit e375d515ff

View File

@ -66,17 +66,20 @@ raw_ostream &WithColor::warning() { return warning(errs()); }
raw_ostream &WithColor::note() { return note(errs()); }
raw_ostream &WithColor::error(raw_ostream &OS, StringRef Prefix) {
OS << Prefix;
if (!Prefix.empty())
OS << Prefix << ": ";
return WithColor(OS, HighlightColor::Error).get() << "error: ";
}
raw_ostream &WithColor::warning(raw_ostream &OS, StringRef Prefix) {
OS << Prefix;
if (!Prefix.empty())
OS << Prefix << ": ";
return WithColor(OS, HighlightColor::Warning).get() << "warning: ";
}
raw_ostream &WithColor::note(raw_ostream &OS, StringRef Prefix) {
OS << Prefix;
if (!Prefix.empty())
OS << Prefix << ": ";
return WithColor(OS, HighlightColor::Note).get() << "note: ";
}