Skip to content

Commit 841f10e

Browse files
committed
[flang][OpenMP] Convert repeatable clauses (except Map) in ClauseProcessor
Rename `findRepeatableClause` to `findRepeatableClause2`, and make the new `findRepeatableClause` operate on new `omp::Clause` objects. Leave `Map` unchanged, because it will require more changes for it to work.
1 parent 57c70c5 commit 841f10e

File tree

2 files changed

+328
-327
lines changed

2 files changed

+328
-327
lines changed

flang/include/flang/Evaluate/tools.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,29 @@ template <typename A> std::optional<CoarrayRef> ExtractCoarrayRef(const A &x) {
430430
}
431431
}
432432

433+
struct ExtractSubstringHelper {
434+
template <typename T> static std::optional<Substring> visit(T &&) {
435+
return std::nullopt;
436+
}
437+
438+
static std::optional<Substring> visit(const Substring &e) { return e; }
439+
440+
template <typename T>
441+
static std::optional<Substring> visit(const Designator<T> &e) {
442+
return std::visit([](auto &&s) { return visit(s); }, e.u);
443+
}
444+
445+
template <typename T>
446+
static std::optional<Substring> visit(const Expr<T> &e) {
447+
return std::visit([](auto &&s) { return visit(s); }, e.u);
448+
}
449+
};
450+
451+
template <typename A>
452+
std::optional<Substring> ExtractSubstring(const A &x) {
453+
return ExtractSubstringHelper::visit(x);
454+
}
455+
433456
// If an expression is simply a whole symbol data designator,
434457
// extract and return that symbol, else null.
435458
template <typename A> const Symbol *UnwrapWholeSymbolDataRef(const A &x) {

0 commit comments

Comments
 (0)