[clang-tools-extra] [clang-doc] Flatten repeated @return and @brief comment arrays (PR #188739)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 3 13:45:10 PDT 2026


================
@@ -150,11 +153,26 @@ static void insertComment(Object &Description, json::Value &Comment,
   auto DescriptionIt = Description.find(Key);
 
   if (DescriptionIt == Description.end()) {
-    auto CommentsArray = json::Array();
-    CommentsArray.push_back(Comment);
-    Description[Key] = std::move(CommentsArray);
+    // For FlattenArray mode, if Comment is an array, use it directly
+    if (FlattenArray && Comment.getAsArray()) {
+      Description[Key] = Comment;
----------------
ilovepi wrote:

doesn't this overwrite the exiting comments if the array was already there...

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


More information about the cfe-commits mailing list