[clang] [flang] [llvm] [CLANG][OpenMP] Add support for OpenMP6.0 transparent clause (PR #166810)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 29 10:59:31 PST 2025
================
@@ -1495,6 +1495,78 @@ 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;
+
+ /// Argument of the 'transparent' clause.
+ Expr *ImpexType = nullptr;
+
+ /// Sets the location of '('.
+ void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
+
+ void setImpexTypeKind(Expr *E) { ImpexType = E; }
+
+public:
+ /// Build 'transparent' clause with argument \a A ('omp_not_impex',
+ /// 'omp_import', 'omp_export' or 'omp_impex')
+ ///
+ /// \param A Argument of the clause ('omp_not_impex', 'omp_import',
+ /// 'omp_export' or 'omp_impex')
+ /// \param ALoc Starting location of the argument.
+ /// \param StartLoc Starting location of the clause.
+ /// \param LParenLoc Location of '('.
+ /// \param EndLoc Ending location of the clause.
+ OMPTransparentClause(Expr *ImpexTypeKind, SourceLocation StartLoc,
+ SourceLocation LParenLoc, SourceLocation EndLoc)
+ : OMPClause(llvm::omp::OMPC_transparent, StartLoc, EndLoc),
+ LParenLoc(LParenLoc), ImpexType(ImpexTypeKind) {}
+
+ /// Build an empty clause.
+ OMPTransparentClause()
+ : OMPClause(llvm::omp::OMPC_transparent, SourceLocation(),
+ SourceLocation()) {}
+
+ /// Returns the location of '('.
+ SourceLocation getLParenLoc() const { return LParenLoc; }
+
+ /// Returns argument of the clause.
+ Expr *getImpexType() const { return cast<Expr>(ImpexType); }
----------------
alexey-bataev wrote:
```suggestion
Expr *getImpexType() const { return ImpexType; }
```
https://github.com/llvm/llvm-project/pull/166810
More information about the llvm-commits
mailing list