summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-04-15 08:44:15 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-04-15 08:44:15 +0000
commit6be1f01935f23d92c967024ee718a7f48748283c (patch)
tree8c29776b29cdfc0fd6f5da905af783c0e9ca69b6 /llvm/lib/Support
parent7c16977a8f8dd927ae246be386bea9b17bbcc15d (diff)
downloadbcm5719-llvm-6be1f01935f23d92c967024ee718a7f48748283c.tar.gz
bcm5719-llvm-6be1f01935f23d92c967024ee718a7f48748283c.zip
[Support] Extend WithColor helpers
Although printing warnings and errors to stderr is by far the most common case, this patch makes it possible to specify any stream. llvm-svn: 330094
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/WithColor.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Support/WithColor.cpp b/llvm/lib/Support/WithColor.cpp
index 29fa16493f7..5a1364ff3cb 100644
--- a/llvm/lib/Support/WithColor.cpp
+++ b/llvm/lib/Support/WithColor.cpp
@@ -59,16 +59,22 @@ WithColor::WithColor(raw_ostream &OS, HighlightColor Color) : OS(OS) {
}
}
-raw_ostream &WithColor::error() {
- return WithColor(errs(), HighlightColor::Error).get() << "error: ";
+raw_ostream &WithColor::error() { return error(errs()); }
+
+raw_ostream &WithColor::warning() { return warning(errs()); }
+
+raw_ostream &WithColor::note() { return note(errs()); }
+
+raw_ostream &WithColor::error(raw_ostream &OS) {
+ return WithColor(OS, HighlightColor::Error).get() << "error: ";
}
-raw_ostream &WithColor::warning() {
- return WithColor(errs(), HighlightColor::Warning).get() << "warning: ";
+raw_ostream &WithColor::warning(raw_ostream &OS) {
+ return WithColor(OS, HighlightColor::Warning).get() << "warning: ";
}
-raw_ostream &WithColor::note() {
- return WithColor(errs(), HighlightColor::Note).get() << "note: ";
+raw_ostream &WithColor::note(raw_ostream &OS) {
+ return WithColor(OS, HighlightColor::Note).get() << "note: ";
}
WithColor::~WithColor() {
OpenPOWER on IntegriCloud