[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
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 73aa501..ba7aef37 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -1196,14 +1196,8 @@
return NumErrors == 0;
}
-raw_ostream &DWARFVerifier::error() const {
- return WithColor(OS, HighlightColor::Error).get() << "error: ";
-}
+raw_ostream &DWARFVerifier::error() const { return WithColor::error(OS); }
-raw_ostream &DWARFVerifier::warn() const {
- return WithColor(OS, HighlightColor::Warning).get() << "warning: ";
-}
+raw_ostream &DWARFVerifier::warn() const { return WithColor::warning(OS); }
-raw_ostream &DWARFVerifier::note() const {
- return WithColor(OS, HighlightColor::Note).get() << "note: ";
-}
+raw_ostream &DWARFVerifier::note() const { return WithColor::note(OS); }