[llvm-branch-commits] [flang] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Apr 23 05:50:21 PDT 2024


================
@@ -88,6 +91,175 @@ void gatherFuncAndVarSyms(
     symbolAndClause.emplace_back(clause, *object.id());
 }
 
+int getComponentPlacementInParent(
+    const Fortran::semantics::Symbol *componentSym) {
+  const auto *derived =
+      componentSym->owner()
+          .derivedTypeSpec()
+          ->typeSymbol()
+          .detailsIf<Fortran::semantics::DerivedTypeDetails>();
+  assert(derived &&
+         "expected derived type details when processing component symbol");
+  int placement = 0;
+  for (auto t : derived->componentNames()) {
+    if (t == componentSym->name())
+      return placement;
+    placement++;
+  }
+  return -1;
+}
+
+std::optional<Object>
+getCompObjOrNull(std::optional<Object> object,
----------------
skatrak wrote:

```suggestion
getComponentObject(std::optional<Object> object,
```

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


More information about the llvm-branch-commits mailing list