[flang-commits] [flang] [Flang][OpenMP] Fix nested PARALLEL SECTIONS validation (PR #179419)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Tue Feb 10 04:54:07 PST 2026


================
@@ -633,11 +633,29 @@ void OmpStructureChecker::CheckMultListItems() {
     CheckMultipleOccurrence(listVars, nameList, clause->source, "LINEAR");
   }
 }
+bool OmpStructureChecker::IsCombinedParallelWorksharing(
+    llvm::omp::Directive directive) const {
+  // Combined parallel-worksharing constructs create their own parallel region
+  // They should not be subject to worksharing nesting restrictions
+  switch (directive) {
+  case llvm::omp::OMPD_parallel_do:
+  case llvm::omp::OMPD_parallel_do_simd:
+  case llvm::omp::OMPD_parallel_sections:
+  case llvm::omp::OMPD_parallel_workshare:
+    return true;
+  default:
+    return false;
+  }
+}
 
 bool OmpStructureChecker::HasInvalidWorksharingNesting(
-    const parser::CharBlock &source, const OmpDirectiveSet &set) {
+    const parser::CharBlock &source, const OmpDirectiveSet &set,
+    llvm::omp::Directive directive) {
----------------
kparzysz wrote:

You could simply pass `const OmpDirectiveName &` instead of `source` and `directive` separately.

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


More information about the flang-commits mailing list