================
@@ -84,8 +84,24 @@ serializeLocation(const Location &Loc,
return LocationObj;
}
+/// Insert comments into a key in the Description object.
+///
+/// \param Comment Either an Object or Array, depending on the comment type
+/// \param Key The type (Brief, Code, etc.) of comment to be inserted
static void insertComment(Object &Description, json::Value &Comment,
StringRef Key) {
+ // The comment has a Children array for the actual text, with meta attributes
+ // alongside it in the Object.
+ if (auto *Obj = Comment.getAsObject()) {
+ if (auto *Children = Obj->getArray("Children");
+ !Children || Children->empty())
+ return;
+ }
----------------
ilovepi wrote:
I see a few checks along these lines ... do you think a helper function would
be useful? It may be easier to reason about. At the very least the check for
the Array existing and being non-empty seems useful for working w/ comment
objects.
https://github.com/llvm/llvm-project/pull/169087
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits