[clang-tools-extra] 29b1af7 - Outputs parameter comments using clang-doc and markdown generator
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 31 11:28:14 PDT 2023
Author: Arnaud Botella
Date: 2023-07-31T14:27:15-04:00
New Revision: 29b1af7396b0839f076ca0a8ae3a5ac47ed55ee7
URL: https://github.com/llvm/llvm-project/commit/29b1af7396b0839f076ca0a8ae3a5ac47ed55ee7
DIFF: https://github.com/llvm/llvm-project/commit/29b1af7396b0839f076ca0a8ae3a5ac47ed55ee7.diff
LOG: Outputs parameter comments using clang-doc and markdown generator
Current implementation outputs the parameter name when used with @param
(or @tparam) doxygen tag but not the comment itself.
Differential Revision: https://reviews.llvm.org/D156322
Added:
Modified:
clang-tools-extra/clang-doc/MDGenerator.cpp
clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-doc/MDGenerator.cpp b/clang-tools-extra/clang-doc/MDGenerator.cpp
index 2f56fd99b7bdcf..795eb4b904e3ef 100644
--- a/clang-tools-extra/clang-doc/MDGenerator.cpp
+++ b/clang-tools-extra/clang-doc/MDGenerator.cpp
@@ -82,10 +82,14 @@ static void writeDescription(const CommentInfo &I, raw_ostream &OS) {
OS << genEmphasis(I.Name) << " " << I.Text;
} else if (I.Kind == "ParamCommandComment") {
std::string Direction = I.Explicit ? (" " + I.Direction).str() : "";
- OS << genEmphasis(I.ParamName) << I.Text << Direction << "\n\n";
+ OS << genEmphasis(I.ParamName) << I.Text << Direction;
+ for (const auto &Child : I.Children)
+ writeDescription(*Child, OS);
} else if (I.Kind == "TParamCommandComment") {
std::string Direction = I.Explicit ? (" " + I.Direction).str() : "";
- OS << genEmphasis(I.ParamName) << I.Text << Direction << "\n\n";
+ OS << genEmphasis(I.ParamName) << I.Text << Direction;
+ for (const auto &Child : I.Children)
+ writeDescription(*Child, OS);
} else if (I.Kind == "VerbatimBlockComment") {
for (const auto &Child : I.Children)
writeDescription(*Child, OS);
diff --git a/clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
index be9ccee3da0a35..1bbd24eebb784a 100644
--- a/clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
+++ b/clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
@@ -347,9 +347,9 @@ TEST(MDGeneratorTest, emitCommentMD) {
The description continues.
-**I** [out]
+**I** [out] is a parameter.
-**J**
+**J** is a parameter.
**return**void
More information about the cfe-commits
mailing list