[flang] [llvm] [Flang] [OpenMP] Add semantic checks for detach clause in task (PR #119172)

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 06:19:25 PST 2024


================
@@ -2739,6 +2739,59 @@ void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
         llvm::omp::Clause::OMPC_copyprivate, {llvm::omp::Clause::OMPC_nowait});
   }
 
+  if (GetContext().directive == llvm::omp::Directive::OMPD_task) {
+    if (auto *d_clause{FindClause(llvm::omp::Clause::OMPC_detach)}) {
+      // OpenMP 5.0: Task construct restrictions
+      CheckNotAllowedIfClause(
+          llvm::omp::Clause::OMPC_detach, {llvm::omp::Clause::OMPC_mergeable});
+
+      // OpenMP 5.2: Task construct restrictions
----------------
kparzysz wrote:

If you're doing version-specific checks, please guard them with the actual version from -fopenmp-version.  You can get it from the language options in context.  This is done in a number of places in this file, you can check how to do it.

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


More information about the llvm-commits mailing list