================
@@ -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:

I think there must be a better way to handle this, than to pass in these 
booleans by reference. Does the state need to be global like that? most of 
these decisions feel local. I'm really not a big fan of this design. It feels 
pretty messy, and the logic here isn't all the well spelled out. 

I think most of our `extract*` APIs typically return the thing they've 
extracted. The one place I think we deviate is in the serializer code, since 
its writing it out to bitcode, generally.

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?

https://github.com/llvm/llvm-project/pull/183754
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to