[flang-commits] [flang] [llvm] [flang][OpenMP] Parser support for DEPOBJ plus DEPEND, DESTROY, UPDATE (PR #114074)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Wed Oct 30 03:38:12 PDT 2024


================
@@ -1261,6 +1261,39 @@ void OmpStructureChecker::Leave(const parser::OpenMPDeclareSimdConstruct &) {
   dirContext_.pop_back();
 }
 
+void OmpStructureChecker::Enter(const parser::OpenMPDepobjConstruct &x) {
+  const auto &dir{std::get<parser::Verbatim>(x.t)};
+  PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_depobj);
+
+  // [5.2:73:27-28]
+  // If the destroy clause appears on a depobj construct, destroy-var must
+  // refer to the same depend object as the depobj argument of the construct.
+  auto &clause{std::get<parser::OmpClause>(x.t)};
+  if (clause.Id() == llvm::omp::Clause::OMPC_destroy) {
+    auto getSymbol = [&](const parser::OmpObject &obj) {
+      return common::visit(
+          [&](auto &&s) { return GetLastName(s).symbol; }, obj.u);
+    };
+
+    auto &wrapper{std::get<parser::OmpClause::Destroy>(clause.u)};
+    if (const std::optional<parser::OmpDestroyClause> &destroy{wrapper.v}) {
+      const Symbol *constrSym = getSymbol(std::get<parser::OmpObject>(x.t));
+      const Symbol *clauseSym = getSymbol(destroy->v);
----------------
kiranchandramohan wrote:

Nit: braced initialization in fronted.

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


More information about the flang-commits mailing list