[llvm] [llvm] Use std::optional::value_or (NFC) (PR #109890)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 17:58:59 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-openmp
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/109890.diff
2 Files Affected:
- (modified) llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h (+1-2)
- (modified) llvm/tools/llvm-cov/SourceCoverageViewText.cpp (+2-2)
``````````diff
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';
``````````
</details>
https://github.com/llvm/llvm-project/pull/109890
More information about the llvm-commits
mailing list