[llvm] r330535 - [Support] Fix prefix logic in WithColor.
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 22 01:01:01 PDT 2018
Author: jdevlieghere
Date: Sun Apr 22 01:01:01 2018
New Revision: 330535
URL: http://llvm.org/viewvc/llvm-project?rev=330535&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Support/WithColor.cpp
Modified: llvm/trunk/lib/Support/WithColor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/WithColor.cpp?rev=330535&r1=330534&r2=330535&view=diff
==============================================================================
--- llvm/trunk/lib/Support/WithColor.cpp (original)
+++ llvm/trunk/lib/Support/WithColor.cpp Sun Apr 22 01:01:01 2018
@@ -66,17 +66,20 @@ raw_ostream &WithColor::warning() { retu
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: ";
}
More information about the llvm-commits
mailing list