[llvm-branch-commits] [clang-tools-extra] [clang-doc] separate comments into categories (PR #149564)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jul 18 12:10:19 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang-tools-extra/clang-doc/JSONGenerator.cpp clang-tools-extra/test/clang-doc/json/class.cpp clang-tools-extra/test/clang-doc/json/concept.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-doc/JSONGenerator.cpp b/clang-tools-extra/clang-doc/JSONGenerator.cpp
index 5c2cb1c75..d39077583 100644
--- a/clang-tools-extra/clang-doc/JSONGenerator.cpp
+++ b/clang-tools-extra/clang-doc/JSONGenerator.cpp
@@ -83,10 +83,11 @@ serializeLocation(const Location &Loc,
return LocationObj;
}
-static void insertComment(Object &Description, json::Value &Comment, std::string Key) {
+static void insertComment(Object &Description, json::Value &Comment,
+ std::string Key) {
auto *CommentArray = Description.getArray(Key);
if (!CommentArray) {
- auto CommentsArray= json::Array();
+ auto CommentsArray = json::Array();
CommentsArray.push_back(Comment);
Description[Key] = std::move(CommentsArray);
Description["Has" + Key] = true;
@@ -231,11 +232,11 @@ serializeCommonAttributes(const Info &I, json::Object &Obj,
Object Description = Object();
// Skip straight to the FullComment's children
auto &Comments = I.Description.at(0).Children;
- for (const auto &CommentInfo: Comments)
- {
+ for (const auto &CommentInfo : Comments) {
json::Value Comment = serializeComment(*CommentInfo, Description);
// Paragraph comments might not be children
- if (auto *ParagraphComment = Comment.getAsObject()->get("ParagraphComment"))
+ if (auto *ParagraphComment =
+ Comment.getAsObject()->get("ParagraphComment"))
insertComment(Description, *ParagraphComment, "ParagraphComments");
}
Obj["Description"] = std::move(Description);
``````````
</details>
https://github.com/llvm/llvm-project/pull/149564
More information about the llvm-branch-commits
mailing list