summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-cov/CoverageReport.cpp2
-rw-r--r--llvm/tools/llvm-cov/CoverageViewOptions.h2
-rw-r--r--llvm/tools/llvm-cov/RenderingSupport.h2
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageViewText.cpp2
-rw-r--r--llvm/tools/llvm-cov/llvm-cov.cpp11
-rw-r--r--llvm/tools/llvm-mca/Views/TimelineView.cpp6
6 files changed, 14 insertions, 11 deletions
diff --git a/llvm/tools/llvm-cov/CoverageReport.cpp b/llvm/tools/llvm-cov/CoverageReport.cpp
index 1750d18d4e0..82259542c59 100644
--- a/llvm/tools/llvm-cov/CoverageReport.cpp
+++ b/llvm/tools/llvm-cov/CoverageReport.cpp
@@ -111,7 +111,7 @@ void renderDivider(ArrayRef<size_t> ColumnWidths, raw_ostream &OS) {
/// 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 3dbb0131ddb..dde0c692ab0 100644
--- a/llvm/tools/llvm-cov/CoverageViewOptions.h
+++ b/llvm/tools/llvm-cov/CoverageViewOptions.h
@@ -46,7 +46,7 @@ struct CoverageViewOptions {
/// 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 b25792e2c4b..0674fbac9a3 100644
--- a/llvm/tools/llvm-cov/RenderingSupport.h
+++ b/llvm/tools/llvm-cov/RenderingSupport.h
@@ -47,7 +47,7 @@ inline raw_ostream &operator<<(const ColoredRawOstream &OS, T &&Value) {
/// 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 f73b91a8511..fcabee2ee69 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
@@ -101,7 +101,7 @@ void SourceCoverageViewText::renderLine(raw_ostream &OS, LineRef L,
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 dabb8afedc8..172ec9f3ced 100644
--- a/llvm/tools/llvm-cov/llvm-cov.cpp
+++ b/llvm/tools/llvm-cov/llvm-cov.cpp
@@ -83,10 +83,13 @@ int main(int argc, const char **argv) {
}
}
- 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 09b6b2a3efe..fe3f16ba344 100644
--- a/llvm/tools/llvm-mca/Views/TimelineView.cpp
+++ b/llvm/tools/llvm-mca/Views/TimelineView.cpp
@@ -103,8 +103,8 @@ void TimelineView::onEvent(const HWInstructionEvent &Event) {
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 @@ static void tryChangeColor(raw_ostream &OS, unsigned Cycles,
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;
OpenPOWER on IntegriCloud