File tree Expand file tree Collapse file tree 3 files changed +29
-24
lines changed Expand file tree Collapse file tree 3 files changed +29
-24
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,16 @@ const OpenMPConstruct *GetOmp(const ExecutionPartConstruct &x);
126126const OpenMPLoopConstruct *GetOmpLoop (const ExecutionPartConstruct &x);
127127const DoConstruct *GetDoConstruct (const ExecutionPartConstruct &x);
128128
129+ // Is the template argument "Statement<T>" for some T?
130+ template <typename T> struct IsStatement {
131+ static constexpr bool value{false };
132+ };
133+ template <typename T> struct IsStatement <Statement<T>> {
134+ static constexpr bool value{true };
135+ };
136+
137+ std::optional<Label> GetStatementLabel (const ExecutionPartConstruct &x);
138+
129139const OmpObjectList *GetOmpObjectList (const OmpClause &clause);
130140
131141template <typename T>
Original file line number Diff line number Diff line change @@ -1731,30 +1731,6 @@ struct NonBlockDoConstructParser {
17311731 }
17321732 return std::nullopt;
17331733 }
1734-
1735- private:
1736- // Is the template argument "Statement<T>" for some T?
1737- template <typename T> struct IsStatement {
1738- static constexpr bool value{false};
1739- };
1740- template <typename T> struct IsStatement<Statement<T>> {
1741- static constexpr bool value{true};
1742- };
1743-
1744- // Get the Label from a Statement<...> contained in an ExecutionPartConstruct,
1745- // or std::nullopt, if there is no Statement<...> contained in there.
1746- template <typename T>
1747- static std::optional<Label> GetStatementLabel(const T &stmt) {
1748- if constexpr (IsStatement<T>::value) {
1749- return stmt.label;
1750- } else if constexpr (WrapperTrait<T>) {
1751- return GetStatementLabel(stmt.v);
1752- } else if constexpr (UnionTrait<T>) {
1753- return common::visit(
1754- [&](auto &&s) { return GetStatementLabel(s); }, stmt.u);
1755- }
1756- return std::nullopt;
1757- }
17581734};
17591735
17601736struct LoopNestParser {
Original file line number Diff line number Diff line change @@ -58,6 +58,25 @@ const DoConstruct *GetDoConstruct(const ExecutionPartConstruct &x) {
5858 return nullptr ;
5959}
6060
61+ // Get the Label from a Statement<...> contained in an ExecutionPartConstruct,
62+ // or std::nullopt, if there is no Statement<...> contained in there.
63+ template <typename T>
64+ static std::optional<Label> GetStatementLabelHelper (const T &stmt) {
65+ if constexpr (IsStatement<T>::value) {
66+ return stmt.label ;
67+ } else if constexpr (WrapperTrait<T>) {
68+ return GetStatementLabelHelper (stmt.v );
69+ } else if constexpr (UnionTrait<T>) {
70+ return common::visit (
71+ [&](auto &&s) { return GetStatementLabelHelper (s); }, stmt.u );
72+ }
73+ return std::nullopt ;
74+ }
75+
76+ std::optional<Label> GetStatementLabel (const ExecutionPartConstruct &x) {
77+ return GetStatementLabelHelper (x);
78+ }
79+
6180const OmpObjectList *GetOmpObjectList (const OmpClause &clause) {
6281 // Clauses with OmpObjectList as its data member
6382 using MemberObjectListClauses = std::tuple<OmpClause::Copyin,
You can’t perform that action at this time.
0 commit comments