[llvm-branch-commits] [clang-tools-extra] [clang-doc] separate comments into categories (PR #149564)
Erick Velez via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jul 18 13:24:11 PDT 2025
================
@@ -210,12 +229,17 @@ serializeCommonAttributes(const Info &I, json::Object &Obj,
}
if (!I.Description.empty()) {
- json::Value DescArray = json::Array();
- auto &DescArrayRef = *DescArray.getAsArray();
- DescArrayRef.reserve(I.Description.size());
- for (const auto &Comment : I.Description)
- DescArrayRef.push_back(serializeComment(Comment));
- Obj["Description"] = DescArray;
+ Object Description = Object();
+ // Skip straight to the FullComment's children
+ auto &Comments = I.Description.at(0).Children;
+ for (const auto &CommentInfo : Comments) {
+ json::Value Comment = serializeComment(*CommentInfo, Description);
+ // Paragraph comments might not be children
+ if (auto *ParagraphComment =
+ Comment.getAsObject()->get("ParagraphComment"))
+ insertComment(Description, *ParagraphComment, "ParagraphComments");
----------------
evelez7 wrote:
Not really, because all paragraph comments were previously handled.
This is meant to signal that there are top level `ParagraphComment`s that can be returned from `serializeComment` that need to be manually inserted into `Description` with this modified scheme. They can't be added like brief comments now are because we can't be sure if the `ParagraphComment` is nested (the text of a brief command is a paragraph comment). So, if the returned comment is a `ParagraphComment`, then it must be a top-level, standalone comment without a command.
Maybe this comment could use a revision.
https://github.com/llvm/llvm-project/pull/149564
More information about the llvm-branch-commits
mailing list