diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-04-21 21:36:11 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-04-21 21:36:11 +0000 |
commit | 0c1b29540ceb4886db2a866eb37c1459aba47c72 (patch) | |
tree | ffbadd98aa3c13ba749b7f8f1f15110aa8753565 /llvm/lib/Support | |
parent | 920802cc50c3c424980f86a65c2736f65aaf69a0 (diff) | |
download | bcm5719-llvm-0c1b29540ceb4886db2a866eb37c1459aba47c72.tar.gz bcm5719-llvm-0c1b29540ceb4886db2a866eb37c1459aba47c72.zip |
[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.
llvm-svn: 330526
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/WithColor.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Support/WithColor.cpp b/llvm/lib/Support/WithColor.cpp index 5a1364ff3cb..c3ab35bd891 100644 --- a/llvm/lib/Support/WithColor.cpp +++ b/llvm/lib/Support/WithColor.cpp @@ -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: "; } |