================ @@ -2013,6 +2014,179 @@ class OMPMergeableClause : public OMPClause { } }; +/// This represents the 'absent' clause in the '#pragma omp assume' +/// directive. +/// +/// \code +/// #pragma omp assume absent(<directive-name list>) +/// \endcode +/// In this example directive '#pragma omp assume' has an 'absent' clause. +class OMPAbsentClause final : public OMPNoChildClause<llvm::omp::OMPC_absent> { + llvm::SmallSet<OpenMPDirectiveKind, 4> DirectiveKinds; + + /// Location of '('. + SourceLocation LParenLoc; + +public: + /// Build 'absent' clause. + /// + /// \param StartLoc Starting location of the clause. + /// \param EndLoc Ending location of the clause. + OMPAbsentClause(llvm::SmallSet<OpenMPDirectiveKind, 4> &DKSet, + SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc) + : OMPNoChildClause(StartLoc, EndLoc), DirectiveKinds(DKSet), + LParenLoc(LParenLoc) {} + + /// Build an empty clause. + OMPAbsentClause() : OMPNoChildClause() {} + + SourceLocation getLParenLoc() { return LParenLoc; } + + void setLParenLoc(SourceLocation S) { LParenLoc = S; } + + llvm::SmallSet<OpenMPDirectiveKind, 4> &getDirectiveKinds() { + return DirectiveKinds; + } + + void setDirectiveKinds(llvm::SmallSet<OpenMPDirectiveKind, 4> &DKS) { + DirectiveKinds = DKS; + } +}; + +/// This represents the 'contains' clause in the '#pragma omp assume' +/// directive. +/// +/// \code +/// #pragma omp assume contains(<directive-name list>) +/// \endcode +/// In this example directive '#pragma omp assume' has a 'contains' clause. +class OMPContainsClause final + : public OMPNoChildClause<llvm::omp::OMPC_contains> { + llvm::SmallSet<OpenMPDirectiveKind, 4> DirectiveKinds; ---------------- jtb20 wrote:
To clarify: do you mean that I should use "ompchildren" and encode the directive kind list as OMPClauses, rather than use a separate allocation/data structure? That would probably work I guess, but it means adding a pseudo-clause type (OMPC_directive_kind or similar), or adding all the possible directive names as clause names also (which seems unwieldy for a relatively obscure feature). Is one of those along the lines of what you were thinking? https://github.com/llvm/llvm-project/pull/92731 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits