Skip to content

Commit 13f97f0

Browse files
authored
[flang][OpenMP] Simplify LooselyStructuredBlockParser, NFC (#156701)
Part of the logic in this parser was dealing with a list of executable constructs that begins with BLOCK. Since after 6b92a3b we're doing it via a lookahead, this handling can be simplified.
1 parent f8f96a4 commit 13f97f0

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

flang/lib/Parser/openmp-parsers.cpp

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,22 +1307,11 @@ struct LooselyStructuredBlockParser {
13071307
if (lookAhead(skipStuffBeforeStatement >> "BLOCK"_tok).Parse(state)) {
13081308
return std::nullopt;
13091309
}
1310-
Block body;
1311-
if (auto epc{attempt(Parser<ExecutionPartConstruct>{}).Parse(state)}) {
1312-
if (!IsFortranBlockConstruct(*epc)) {
1313-
body.emplace_back(std::move(*epc));
1314-
if (auto &&blk{attempt(block).Parse(state)}) {
1315-
for (auto &&s : *blk) {
1316-
body.emplace_back(std::move(s));
1317-
}
1318-
}
1319-
} else {
1320-
// Fail if the first construct is BLOCK.
1321-
return std::nullopt;
1322-
}
1310+
if (auto &&body{block.Parse(state)}) {
1311+
// Empty body is ok.
1312+
return std::move(body);
13231313
}
1324-
// Empty body is ok.
1325-
return std::move(body);
1314+
return std::nullopt;
13261315
}
13271316
};
13281317

0 commit comments

Comments
 (0)