Revert r367649: Improve raw_ostream so that you can "write" colors using operator<<
This reverts commit r367649 in an attempt to unbreak Windows bots.
llvm-svn: 367658
diff --git a/llvm/tools/llvm-cov/CoverageReport.cpp b/llvm/tools/llvm-cov/CoverageReport.cpp
index 1750d18..8225954 100644
--- a/llvm/tools/llvm-cov/CoverageReport.cpp
+++ b/llvm/tools/llvm-cov/CoverageReport.cpp
@@ -111,7 +111,7 @@
/// Return the color which correponds to the coverage percentage of a
/// certain metric.
template <typename T>
-raw_ostream::Color determineCoveragePercentageColor(const T &Info) {
+raw_ostream::Colors determineCoveragePercentageColor(const T &Info) {
if (Info.isFullyCovered())
return raw_ostream::GREEN;
return Info.getPercentCovered() >= 80.0 ? raw_ostream::YELLOW
diff --git a/llvm/tools/llvm-cov/CoverageViewOptions.h b/llvm/tools/llvm-cov/CoverageViewOptions.h
index 3dbb013..dde0c69 100644
--- a/llvm/tools/llvm-cov/CoverageViewOptions.h
+++ b/llvm/tools/llvm-cov/CoverageViewOptions.h
@@ -46,7 +46,7 @@
/// Change the output's stream color if the colors are enabled.
ColoredRawOstream colored_ostream(raw_ostream &OS,
- raw_ostream::Color Color) const {
+ raw_ostream::Colors Color) const {
return llvm::colored_ostream(OS, Color, Colors);
}
diff --git a/llvm/tools/llvm-cov/RenderingSupport.h b/llvm/tools/llvm-cov/RenderingSupport.h
index b25792e..0674fba 100644
--- a/llvm/tools/llvm-cov/RenderingSupport.h
+++ b/llvm/tools/llvm-cov/RenderingSupport.h
@@ -47,7 +47,7 @@
/// Change the color of the output stream if the `IsColorUsed` flag
/// is true. Returns an object that resets the color when destroyed.
inline ColoredRawOstream colored_ostream(raw_ostream &OS,
- raw_ostream::Color Color,
+ raw_ostream::Colors Color,
bool IsColorUsed = true,
bool Bold = false, bool BG = false) {
if (IsColorUsed)
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
index f73b91a..fcabee2 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
@@ -101,7 +101,7 @@
auto *WrappedSegment = LCS.getWrappedSegment();
CoverageSegmentArray Segments = LCS.getLineSegments();
- Optional<raw_ostream::Color> Highlight;
+ Optional<raw_ostream::Colors> Highlight;
SmallVector<std::pair<unsigned, unsigned>, 2> HighlightedRanges;
// The first segment overlaps from a previous line, so we treat it specially.
diff --git a/llvm/tools/llvm-cov/llvm-cov.cpp b/llvm/tools/llvm-cov/llvm-cov.cpp
index dabb8afe..172ec9f 100644
--- a/llvm/tools/llvm-cov/llvm-cov.cpp
+++ b/llvm/tools/llvm-cov/llvm-cov.cpp
@@ -83,10 +83,13 @@
}
}
- if (argc > 1)
- errs() << raw_ostream::RED << "Unrecognized command: " << argv[1] << ".\n\n"
- << raw_ostream::RESET;
-
+ if (argc > 1) {
+ if (sys::Process::StandardErrHasColors())
+ errs().changeColor(raw_ostream::RED);
+ errs() << "Unrecognized command: " << argv[1] << ".\n\n";
+ if (sys::Process::StandardErrHasColors())
+ errs().resetColor();
+ }
helpMain(argc, argv);
return 1;
}
diff --git a/llvm/tools/llvm-mca/Views/TimelineView.cpp b/llvm/tools/llvm-mca/Views/TimelineView.cpp
index 09b6b2a..fe3f16b 100644
--- a/llvm/tools/llvm-mca/Views/TimelineView.cpp
+++ b/llvm/tools/llvm-mca/Views/TimelineView.cpp
@@ -103,8 +103,8 @@
LastCycle = std::max(LastCycle, CurrentCycle);
}
-static raw_ostream::Color chooseColor(unsigned CumulativeCycles,
- unsigned Executions, int BufferSize) {
+static raw_ostream::Colors chooseColor(unsigned CumulativeCycles,
+ unsigned Executions, int BufferSize) {
if (CumulativeCycles && BufferSize < 0)
return raw_ostream::MAGENTA;
unsigned Size = static_cast<unsigned>(BufferSize);
@@ -120,7 +120,7 @@
if (!OS.has_colors())
return;
- raw_ostream::Color Color = chooseColor(Cycles, Executions, BufferSize);
+ raw_ostream::Colors Color = chooseColor(Cycles, Executions, BufferSize);
if (Color == raw_ostream::SAVEDCOLOR) {
OS.resetColor();
return;