aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-09-24 21:49:06 -0700
committerGitHub <noreply@github.com>2024-09-24 21:49:06 -0700
commit74d9f7ce80e8d729c18f12bde73bdd8ea750b369 (patch)
treeb6e8e85e09df5be70f22e7788f4230a70755888f /llvm/tools/llvm-cov/SourceCoverageViewText.cpp
parentd0878f13dffa406a267eb8d0b64f803951e997ea (diff)
downloadllvm-74d9f7ce80e8d729c18f12bde73bdd8ea750b369.zip
llvm-74d9f7ce80e8d729c18f12bde73bdd8ea750b369.tar.gz
llvm-74d9f7ce80e8d729c18f12bde73bdd8ea750b369.tar.bz2
[llvm] Use std::optional::value_or (NFC) (#109890)
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageViewText.cpp')
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageViewText.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
index cab60c2..8b93b59 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
@@ -179,7 +179,7 @@ void SourceCoverageViewText::renderLine(raw_ostream &OS, LineRef L,
unsigned Col = 1;
for (const auto *S : Segments) {
unsigned End = std::min(S->Col, static_cast<unsigned>(Line.size()) + 1);
- colored_ostream(OS, Highlight ? *Highlight : raw_ostream::SAVEDCOLOR,
+ colored_ostream(OS, Highlight.value_or(raw_ostream::SAVEDCOLOR),
getOptions().Colors && Highlight, /*Bold=*/false,
/*BG=*/true)
<< Line.substr(Col - 1, End - Col);
@@ -196,7 +196,7 @@ void SourceCoverageViewText::renderLine(raw_ostream &OS, LineRef L,
}
// Show the rest of the line.
- colored_ostream(OS, Highlight ? *Highlight : raw_ostream::SAVEDCOLOR,
+ colored_ostream(OS, Highlight.value_or(raw_ostream::SAVEDCOLOR),
getOptions().Colors && Highlight, /*Bold=*/false, /*BG=*/true)
<< Line.substr(Col - 1, Line.size() - Col + 1);
OS << '\n';