================
@@ -98,10 +114,29 @@ static void insertComment(Object &Description, json::Value
&Comment,
}
}
+/// Takes the nested "Children" array from a comment Object.
+///
+/// \return a json::Array of comments, possible json::Value::Kind::Null
static json::Value extractTextComments(Object *ParagraphComment) {
if (!ParagraphComment)
- return json::Object();
- return *ParagraphComment->get("Children");
+ return json::Value(nullptr);
+ json::Value *Children = ParagraphComment->get("Children");
+ if (!Children)
+ return json::Value(nullptr);
+ auto ChildrenArray = *Children->getAsArray();
+ auto ChildrenIt = ChildrenArray.begin();
+ while (ChildrenIt != ChildrenArray.end()) {
+ auto *ChildObj = ChildrenIt->getAsObject();
+ if (!ChildObj)
+ break;
----------------
ilovepi wrote:
you just return on the first one that isn't an object?
https://github.com/llvm/llvm-project/pull/169087
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits