[llvm] 74d9f7c - [llvm] Use std::optional::value_or (NFC) (#109890)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 21:49:10 PDT 2024
Author: Kazu Hirata
Date: 2024-09-24T21:49:06-07:00
New Revision: 74d9f7ce80e8d729c18f12bde73bdd8ea750b369
URL: https://github.com/llvm/llvm-project/commit/74d9f7ce80e8d729c18f12bde73bdd8ea750b369
DIFF: https://github.com/llvm/llvm-project/commit/74d9f7ce80e8d729c18f12bde73bdd8ea750b369.diff
LOG: [llvm] Use std::optional::value_or (NFC) (#109890)
Added:
Modified:
llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
llvm/tools/llvm-cov/SourceCoverageViewText.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index b93bc594a82bf3..4bdfa1cf4c1490 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -916,8 +916,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
/*ReductionIdentifiers=*/std::get<ReductionIdentifiers>(clause.t),
/*List=*/objects}});
- ReductionModifier effective =
- modifier.has_value() ? *modifier : ReductionModifier::Default;
+ ReductionModifier effective = modifier.value_or(ReductionModifier::Default);
bool effectiveApplied = false;
// Walk over the leaf constructs starting from the innermost, and apply
// the clause as required by the spec.
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
index cab60c2d9034ed..8b93b592910b3d 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';
More information about the llvm-commits
mailing list