From e375d515ff4ee70475fca720a339e1cedf658807 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sun, 22 Apr 2018 08:01:01 +0000 Subject: [PATCH] [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 --- lib/Support/WithColor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Support/WithColor.cpp b/lib/Support/WithColor.cpp index c3ab35bd891..a663c69ac3e 100644 --- a/lib/Support/WithColor.cpp +++ b/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: "; } -- 2.11.0