[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:48:19 PST 2024


================
@@ -2357,6 +2441,52 @@ bool OmpStructureChecker::CheckReductionOperators(
 
   return ok;
 }
+
+void OmpStructureChecker::AddModifierToMap(
+    const parser::OmpObjectList &x, const ReductionModifier &modifier) {
+  for (const auto &ompObject : x.v) {
+    if (const auto *name{parser::Unwrap<parser::Name>(ompObject)}) {
+      if (const auto *symbol{name->symbol}) {
+        GetContext().reductionMod[symbol->name().ToString()] = modifier;
+      }
+    }
+  }
+}
+
+void OmpStructureChecker::CheckAndAddSymbolsToUsedInScanList(
+    const parser::OmpObjectList &x) {
+  for (const auto &ompObj : x.v) {
+    auto checkScanSymbolInReduction = [&](const parser::Name *name) {
+      if (name->symbol) {
+        if (CurrentDirectiveIsNested()) {
+          std::string nameStr = name->symbol->name().ToString();
+          if (GetContextParent().reductionMod.find(nameStr) ==
+              GetContextParent().reductionMod.end()) {
+
+            context_.Say(name->source,
+                "List item %s must appear in 'reduction' clause "
+                "with the 'inscan' modifier of the parent "
+                "directive"_err_en_US,
----------------
anchuraj wrote:

Changed

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


More information about the flang-commits mailing list