[flang-commits] [flang] [flang][OpenMP] Add semantic check for target update (PR #71305)

via flang-commits flang-commits at lists.llvm.org
Mon Nov 6 10:55:43 PST 2023


================
@@ -1401,6 +1401,20 @@ void OmpStructureChecker::CheckTargetUpdate() {
     context_.Say(GetContext().directiveSource,
         "At least one motion-clause (TO/FROM) must be specified on TARGET UPDATE construct."_err_en_US);
   }
+  if (toClause && fromClause) {
+    SymbolSourceMap toSymbols, fromSymbols;
+    GetSymbolsInObjectList(
+        std::get<parser::OmpClause::To>(toClause->u).v, toSymbols);
+    GetSymbolsInObjectList(
+        std::get<parser::OmpClause::From>(fromClause->u).v, fromSymbols);
+    for (auto &[symbol, source] : toSymbols) {
+      if (fromSymbols.find(symbol) != fromSymbols.end()) {
+        context_.Say(source,
+            "Symbol '%s': A list item can only appear in a to or from clause, but not in both."_err_en_US,
----------------
shraiysh wrote:

Done

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


More information about the flang-commits mailing list