[llvm-branch-commits] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #111192)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Oct 22 07:43:25 PDT 2024


================
@@ -183,99 +347,69 @@ getComponentObject(std::optional<Object> object,
   return getComponentObject(baseObj.value(), semaCtx);
 }
 
-static void
-generateMemberPlacementIndices(const Object &object,
-                               llvm::SmallVectorImpl<int> &indices,
-                               semantics::SemanticsContext &semaCtx) {
+void generateMemberPlacementIndices(const Object &object,
+                                    llvm::SmallVectorImpl<int64_t> &indices,
+                                    semantics::SemanticsContext &semaCtx) {
+  indices.clear();
   auto compObj = getComponentObject(object, semaCtx);
+
   while (compObj) {
-    indices.push_back(getComponentPlacementInParent(compObj->sym()));
+    int64_t index = getComponentPlacementInParent(compObj->sym());
+    assert(index >= 0);
----------------
skatrak wrote:

Nit: Add a comment to the assert.

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


More information about the llvm-branch-commits mailing list