================
@@ -67,6 +70,46 @@ static void writeSourceFileRef(const ClangDocContext &CDCtx, 
const Location &L,
   OS << "\n\n";
 }
 
+static void extractCommentText(const CommentInfo &Comment,
+                               llvm::raw_ostream &OS) {
+
+  OS << Comment.Text;
+  bool FirstChild = true;
+
+  for (size_t Idx = 0, End = Comment.Children.size(); Idx < End; ++Idx) {
+    const auto &Child = Comment.Children[Idx];
+    llvm::SmallString<128> ChildBuffer;
+    llvm::raw_svector_ostream ChildOS(ChildBuffer);
+    extractCommentText(*Child, ChildOS);
+
+    if (ChildBuffer.empty())
+      continue;
+
+    if (Idx > 0 && Comment.Kind == CommentKind::CK_ParagraphComment &&
+        Comment.Children[Idx - 1]->Kind == CommentKind::CK_TextComment &&
+        Child->Kind == CommentKind::CK_TextComment)
+      OS << "<br>";
+
+    if (FirstChild)
+      FirstChild = false;
+    else if (Comment.Kind == CommentKind::CK_BlockCommandComment ||
+             Comment.Kind == CommentKind::CK_FullComment)
+      OS << "<br><br>";
+
+    OS << ChildBuffer;
----------------
SamrudhNelli wrote:

This approach is surely a lot more readable efficient than the previous one.. 
Thank you so much for helping me out with the approach.🙏

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