[flang-commits] [flang] [llvm] [Flang][OpenMP][Sema] Adding parsing and semantic support for scan directive. (PR #102792)

Anchu Rajendran S via flang-commits flang-commits at lists.llvm.org
Thu Nov 14 11:47:37 PST 2024


================
@@ -1383,19 +1431,32 @@ void OmpStructureChecker::Leave(const parser::OpenMPAllocatorsConstruct &x) {
   dirContext_.pop_back();
 }
 
+void OmpStructureChecker::CheckScan(
+    const parser::OpenMPSimpleStandaloneConstruct &x) {
+  if (std::get<parser::OmpClauseList>(x.t).v.size() != 1) {
+    context_.Say(x.source,
+        "Exactly one of `exclusive` or `inclusive` clause is expected"_err_en_US);
+  }
+  if (!CurrentDirectiveIsNested() ||
+      !llvm::omp::scanParentAllowedSet.test(GetContextParent().directive)) {
+    context_.Say(x.source,
+        "Orphaned `omp scan` directives are prohibited; perhaps you forgot "
+        "to enclose the directive in to a worksharing loop, a worksharing "
+        "loop simd or a simd directive."_err_en_US);
----------------
anchuraj wrote:

Changed

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


More information about the flang-commits mailing list