Skip to content

Commit 74d9f7c

Browse files
[llvm] Use std::optional::value_or (NFC) (#109890)
1 parent d0878f1 commit 74d9f7c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
916916
/*ReductionIdentifiers=*/std::get<ReductionIdentifiers>(clause.t),
917917
/*List=*/objects}});
918918

919-
ReductionModifier effective =
920-
modifier.has_value() ? *modifier : ReductionModifier::Default;
919+
ReductionModifier effective = modifier.value_or(ReductionModifier::Default);
921920
bool effectiveApplied = false;
922921
// Walk over the leaf constructs starting from the innermost, and apply
923922
// the clause as required by the spec.

llvm/tools/llvm-cov/SourceCoverageViewText.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void SourceCoverageViewText::renderLine(raw_ostream &OS, LineRef L,
179179
unsigned Col = 1;
180180
for (const auto *S : Segments) {
181181
unsigned End = std::min(S->Col, static_cast<unsigned>(Line.size()) + 1);
182-
colored_ostream(OS, Highlight ? *Highlight : raw_ostream::SAVEDCOLOR,
182+
colored_ostream(OS, Highlight.value_or(raw_ostream::SAVEDCOLOR),
183183
getOptions().Colors && Highlight, /*Bold=*/false,
184184
/*BG=*/true)
185185
<< Line.substr(Col - 1, End - Col);
@@ -196,7 +196,7 @@ void SourceCoverageViewText::renderLine(raw_ostream &OS, LineRef L,
196196
}
197197

198198
// Show the rest of the line.
199-
colored_ostream(OS, Highlight ? *Highlight : raw_ostream::SAVEDCOLOR,
199+
colored_ostream(OS, Highlight.value_or(raw_ostream::SAVEDCOLOR),
200200
getOptions().Colors && Highlight, /*Bold=*/false, /*BG=*/true)
201201
<< Line.substr(Col - 1, Line.size() - Col + 1);
202202
OS << '\n';

0 commit comments

Comments
 (0)