================
@@ -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;
+ } else {
+ auto CommentsArray = json::Array();
+ CommentsArray.push_back(Comment);
+ Description[Key] = std::move(CommentsArray);
+ }
Description["Has" + Key.str()] = true;
} else {
+ // For FlattenArray mode, if Comment is an array, merge its elements
+ if (FlattenArray) {
+ if (auto *CommentArray = Comment.getAsArray()) {
+ auto *DestArray = DescriptionIt->getSecond().getAsArray();
----------------
ilovepi wrote:
If you're going to get a reference to this here and its used below, then hoist
that out of the conditional and don't recalculate it or rely on the compiler to
fold it away. Also, since you're dereffing it take a reference. otherwise you
need to have some kind of validity check on the pointer value.
https://github.com/llvm/llvm-project/pull/188739
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits