[clang] [flang] [llvm] [CLANG][OpenMP] Add support for OpenMP6.0 transparent clause (PR #166810)

Abhinav Gaba via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 14:43:52 PST 2025


================
@@ -1495,6 +1504,100 @@ class OMPThreadsetClause final : public OMPClause {
   }
 };
 
+/// This class represents the 'transparent' clause in the '#pragma omp task'
+/// directive.
+///
+/// \code
+/// #pragma omp task transparent(omp_not_impex)
+/// \endcode
+///
+/// In this example, the directive '#pragma omp task' has a 'transparent'
+/// clause with OpenMP keyword 'omp_not_impex`. Other valid keywords that may
+/// appear in this clause are 'omp_import', 'omp_export' and 'omp_impex'.
+///
+class OMPTransparentClause final : public OMPClause {
+  friend class OMPClauseReader;
+
+  /// Location of '('.
+  SourceLocation LParenLoc;
+
+  /// A kind of the 'transparent' clause.
+  OpenMPTransparentKind Kind = OMPC_TRANSPARENT_unknown;
+
+  /// Start location of the kind in source code.
+  SourceLocation KindLoc;
+
+  /// Argument of the 'transparent' clause.
+  Stmt *Transparent = nullptr;
+
+  /// Set kind of the clauses.
+  ///
+  /// \param K Argument of clause.
+  void setTransparentKind(OpenMPTransparentKind K) { Kind = K; }
+
+  /// Set argument location.
+  ///
+  /// \param KLoc Argument location.
+  void setTransparentKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
----------------
abhinavgaba wrote:

Since it's the loc for the argument, not its kind, it would be more appropriate to call it something like `setImpexTypeLoc`.

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


More information about the llvm-commits mailing list