[clang] [llvm] [OpenMP] OpenMP 5.1 "assume" directive parsing support (PR #92731)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 08:30:28 PDT 2024


================
@@ -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;
----------------
alexey-bataev wrote:

I mean that dynamic data types (do vectors, sets, etc.) are not allowed in AST

https://github.com/llvm/llvm-project/pull/92731


More information about the cfe-commits mailing list