================ @@ -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); + } ---------------- ilovepi wrote:
Here's another code pattern I see repeated a lot. 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