@@ -164,11 +164,8 @@ void RewriteMutator::OpenMPSimdOnly(parser::SpecificationPart &specPart) {
164
164
// loop.
165
165
void RewriteMutator::OpenMPSimdOnly (
166
166
parser::Block &block, bool isNonSimdLoopBody = false ) {
167
- using ExecutionListIterator =
168
- std::_List_iterator<parser::ExecutionPartConstruct>;
169
167
auto replaceInlineBlock =
170
- [&](std::list<parser::ExecutionPartConstruct> &block,
171
- ExecutionListIterator it) -> ExecutionListIterator {
168
+ [&](std::list<parser::ExecutionPartConstruct> &block, auto it) -> auto {
172
169
auto insertPos = std::next (it);
173
170
block.splice (insertPos, block);
174
171
block.erase (it);
@@ -410,9 +407,11 @@ bool RewriteMutator::Pre(parser::OpenMPLoopConstruct &ompLoop) {
410
407
// call OpenMPSimdOnly on the nested loop block while indicating where
411
408
// the block comes from.
412
409
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 );
410
+ if (!nest.has_value ()) {
411
+ return true ;
412
+ }
413
+ if (auto *doConstruct = std::get_if<parser::DoConstruct>(&*nest)) {
414
+ auto &innerBlock = std::get<parser::Block>(doConstruct->t );
416
415
OpenMPSimdOnly (innerBlock, /* isNonSimdLoopBody=*/ true );
417
416
}
418
417
}
0 commit comments