================
@@ -67,28 +68,42 @@ static void writeSourceFileRef(const ClangDocContext
&CDCtx, const Location &L,
OS << "\n\n";
}
-static std::string genRawText(const std::vector<CommentInfo> &Comments) {
- std::string Result;
- llvm::raw_string_ostream OS(Result);
- std::queue<const CommentInfo *> Q;
- for (const auto &CI : Comments)
- Q.push(&CI);
- const CommentInfo *Comment;
- bool First = true;
- while (Q.size()) {
- Comment = Q.front();
- Q.pop();
- if (!Comment->Text.empty()) {
- if (!First)
- OS << "<br>";
- else
- First = false;
- OS << Comment->Text;
+static void extractChildComment(const CommentInfo &Comment,
+ llvm::raw_ostream &OS, bool &FirstLine,
+ bool &FirstParagraph, bool &ParagraphBreak) {
----------------
ilovepi wrote:
> > Additionally, it seems to me that building this up as a string is adding
> > some complexity that I'm not a huge fan of... have you considered other
> > options? you're eventually writing this to a stream anyway, so why not just
> > skip the middle man?
>
> We could write straight to the `Members` stream in `genMarkdown()`. This
> approach would require no string usage. But since we currently have `Members
> << "| " << (CommentString.empty() ? "--" : CommentString) << " ";` in
> `genMarkdown()`, we would need to store the `genCommentString()` output or a
> boolean somewhere and check whether its empty before passing to the stream.
> Are you okay with having a string / boolean inside `genCommentString()` or do
> you suggest omitting the `--` printed for empty comments?
Can't that bit about empty output be done in the callee?
https://github.com/llvm/llvm-project/pull/183754
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits