[clang-tools-extra] Refactor clang doc comment structure (PR #142273)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 5 11:10:24 PDT 2025


================
@@ -208,37 +208,105 @@ static json::Value extractValue(const TypedefInfo &I) {
 }
 
 static json::Value extractValue(const CommentInfo &I) {
-  assert((I.Kind == "BlockCommandComment" || I.Kind == "FullComment" ||
-          I.Kind == "ParagraphComment" || I.Kind == "TextComment") &&
-         "Unknown Comment type in CommentInfo.");
-
   Object Obj = Object();
-  json::Value Child = Object();
-
-  // TextComment has no children, so return it.
-  if (I.Kind == "TextComment") {
-    Obj.insert({"TextComment", I.Text});
-    return Obj;
-  }
-
-  // BlockCommandComment needs to generate a Command key.
-  if (I.Kind == "BlockCommandComment")
-    Child.getAsObject()->insert({"Command", I.Name});
+  Object Child;
----------------
ilovepi wrote:

hmm, this is better, but do you think it would be nicer if we avoided the move constructors by doing this?
```suggestion
  json::Value ChildVal
  Object& Child = *ChildVal.getAsObject();
```
WDYT?

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


More information about the cfe-commits mailing list