Skip to content

Commit 33d63a3

Browse files
committed
Use non-throwing get
1 parent 0e7c0af commit 33d63a3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

flang/lib/Semantics/rewrite-parse-tree.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,11 @@ bool RewriteMutator::Pre(parser::OpenMPLoopConstruct &ompLoop) {
410410
// call OpenMPSimdOnly on the nested loop block while indicating where
411411
// the block comes from.
412412
auto &nest = std::get<std::optional<parser::NestedConstruct>>(ompLoop.t);
413-
if (nest.has_value()) {
414-
auto &doConstruct = std::get<parser::DoConstruct>(nest.value());
415-
auto &innerBlock = std::get<parser::Block>(doConstruct.t);
413+
if (!nest.has_value()) {
414+
return true;
415+
}
416+
if (auto *doConstruct = std::get_if<parser::DoConstruct>(&*nest)) {
417+
auto &innerBlock = std::get<parser::Block>(doConstruct->t);
416418
OpenMPSimdOnly(innerBlock, /*isNonSimdLoopBody=*/true);
417419
}
418420
}

0 commit comments

Comments
 (0)