[clang-tools-extra] [clang-doc] refactor JSON for better Mustache compatibility (PR #149588)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 21 13:57:47 PDT 2025


================
@@ -234,10 +267,12 @@ static void serializeArray(const Container &Records, Object &Obj,
   json::Value RecordsArray = Array();
   auto &RecordsArrayRef = *RecordsArray.getAsArray();
   RecordsArrayRef.reserve(Records.size());
-  for (const auto &Item : Records) {
+  for (size_t Index = 0; Index < Records.size(); ++Index) {
----------------
ilovepi wrote:

I don't think `enumerate()` will make this nicer, but its available if you do. It's not the most widely used pattern, but I'd hate for you not to know its around (like I did for a couple years).

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


More information about the cfe-commits mailing list