================ @@ -248,6 +257,27 @@ static void serializeCommonChildren(const ScopeChildren &Children, } } +template <typename T, typename SerializationFunc> +static void serializeArray(const std::vector<T> &Records, Object &Obj, + const std::string &Key, + SerializationFunc serializeInfo) { + json::Value RecordsArray = Array(); + auto &RecordsArrayRef = *RecordsArray.getAsArray(); + RecordsArrayRef.reserve(Records.size()); + for (const auto &Item : Records) { + json::Value ItemVal = Object(); + auto &ItemObj = *ItemVal.getAsObject(); + serializeInfo(Item, ItemObj); + RecordsArrayRef.push_back(ItemVal); + } ---------------- evelez7 wrote:
I'm going to refactor a lot of the code in here later to call this function for arrays. And I'll probably make a similar one for objects that just get a value declared and passed to `serializeInfo`. https://github.com/llvm/llvm-project/pull/144430 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits