================ @@ -175,99 +271,63 @@ 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) { auto compObj = getComponentObject(object, semaCtx); while (compObj) { - indices.push_back(getComponentPlacementInParent(compObj->sym())); + int64_t index = getComponentPlacementInParent(compObj->sym()); + assert(index >= 0); + indices.push_back(index); compObj = getComponentObject(getBaseObject(compObj.value(), semaCtx), semaCtx); } - indices = llvm::SmallVector<int>{llvm::reverse(indices)}; + indices = llvm::SmallVector<int64_t>{llvm::reverse(indices)}; ---------------- skatrak wrote:
Nit: How about doing the reversal in place to avoid allocations? Some combination of `llvm::zip_equal(indices, llvm::reverse(indices))` and `std::swap` perhaps? https://github.com/llvm/llvm-project/pull/96266 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits