[clang-tools-extra] [clang-doc] Do not serialize empty text comments (PR #169087)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 21 15:11:06 PST 2025
================
@@ -84,8 +84,13 @@ serializeLocation(const Location &Loc,
return LocationObj;
}
+/// \param Comment A json::Array possibly containing TextComments
+/// \param Key The type (Brief, Code) of comment to be inserted
static void insertComment(Object &Description, json::Value &Comment,
StringRef Key) {
+ auto *TextCommentArray = Comment.getAsArray();
+ if (TextCommentArray && TextCommentArray->empty())
----------------
ilovepi wrote:
```suggestion
if (!TextCommentArray || TextCommentArray->empty())
```
Is this more along the lines of what you're after? Return early if we don't get something valid back?
https://github.com/llvm/llvm-project/pull/169087
More information about the cfe-commits
mailing list