summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-04-22 08:01:01 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-04-22 08:01:01 +0000
commit578c04949739cb02459716345036e56e39520fc5 (patch)
treefa944efea8728912dee416da28c23e077f035472
parent9dcc50fcef32efbd8f49d7157349003ed996c230 (diff)
downloadbcm5719-llvm-578c04949739cb02459716345036e56e39520fc5.tar.gz
bcm5719-llvm-578c04949739cb02459716345036e56e39520fc5.zip
[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. llvm-svn: 330535
-rw-r--r--llvm/lib/Support/WithColor.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Support/WithColor.cpp b/llvm/lib/Support/WithColor.cpp
index c3ab35bd891..a663c69ac3e 100644
--- a/llvm/lib/Support/WithColor.cpp
+++ b/llvm/lib/Support/WithColor.cpp
@@ -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: ";
}
OpenPOWER on IntegriCloud