================
@@ -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) {
+ if (Comment.Kind == CommentKind::CK_ParagraphComment) {
+ if (!FirstParagraph)
+ ParagraphBreak = true;
+ }
+
+ if (!Comment.Text.empty()) {
+ if (FirstParagraph)
+ FirstParagraph = false;
+ if (ParagraphBreak) {
+ OS << "<br><br>";
+ ParagraphBreak = false;
+ FirstLine = true;
}
- for (const auto &CI : Comment->Children)
- Q.push(CI.get());
+
+ if (!FirstLine)
+ OS << "<br>";
+ else
+ FirstLine = false;
+
+ OS << Comment.Text;
}
- return Result;
+
+ for (const auto &Child : Comment.Children)
+ extractChildComment(*Child, OS, FirstLine, FirstParagraph, ParagraphBreak);
+}
+
+static void genCommentString(ArrayRef<CommentInfo> Comments,
+ std::string &Buffer) {
----------------
ilovepi wrote:
Why does this have an in/out parameter, instead of just returning the value to
the caller?
https://github.com/llvm/llvm-project/pull/183754
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits