[clang-tools-extra] [clang-doc] Update serializer for improved template handling (PR #138065)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Tue May 27 15:46:52 PDT 2025


================
@@ -35,6 +35,169 @@ static void populateMemberTypeInfo(RecordInfo &I, AccessSpecifier &Access,
                                    const DeclaratorDecl *D,
                                    bool IsStatic = false);
 
+static void getTemplateParameters(const TemplateParameterList *TemplateParams,
+                                  llvm::raw_ostream &Stream) {
+  Stream << "template <";
+
+  for (unsigned i = 0; i < TemplateParams->size(); ++i) {
+    if (i > 0)
+      Stream << ", ";
+
+    const NamedDecl *Param = TemplateParams->getParam(i);
+    if (const auto *TTP = llvm::dyn_cast<TemplateTypeParmDecl>(Param)) {
+      if (TTP->wasDeclaredWithTypename())
+        Stream << "typename";
+      else
+        Stream << "class";
+      if (TTP->isParameterPack())
+        Stream << "...";
+      Stream << " " << TTP->getNameAsString();
----------------
ilovepi wrote:

Not totally convinced my solution is correct, but we can follow up once we are testing the mustache implementation more thoroughly.

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


More information about the cfe-commits mailing list