[clang-tools-extra] [clang-doc] Add a Mustache Markdown generator (PR #177221)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 11:55:11 PST 2026


================
@@ -771,7 +787,31 @@ static void serializeInfo(const NamespaceInfo &I, json::Object &Obj,
     Obj["HasVariables"] = true;
   }
 
-  serializeCommonChildren(I.Children, Obj, RepositoryUrl, RepositoryLinePrefix);
+  if (Markdown) {
+    SmallString<64> BasePath = I.getRelativeFilePath("");
+    // serializeCommonChildren doesn't accept Infos, so this lambda needs to be
+    // created here. To avoid making serializeCommonChildren a template, this
+    // lambda is an std::function
+    ReferenceFunc SerializeMDReferenceLambda =
+        [BasePath](const Reference &Ref, Object &Object) {
+          serializeMDReference(Ref, Object, BasePath);
+        };
+    serializeCommonChildren(I.Children, Obj, RepositoryUrl,
+                            RepositoryLinePrefix, SerializeMDReferenceLambda);
+    if (!I.Children.Namespaces.empty()) {
+      serializeArray(I.Children.Namespaces, Obj, "Namespaces",
+                     SerializeMDReferenceLambda);
+      Obj["HasNamespaces"] = true;
+    }
----------------
ilovepi wrote:

This block looks common to both branches.

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


More information about the cfe-commits mailing list