-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[clang-doc] add param comments to comment template #150571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesSerializes parameter comments for all descriptions. Full diff: https://github.com/llvm/llvm-project/pull/150571.diff 3 Files Affected:
diff --git a/clang-tools-extra/clang-doc/JSONGenerator.cpp b/clang-tools-extra/clang-doc/JSONGenerator.cpp
index 92a4117c4e534..5fc28406ee870 100644
--- a/clang-tools-extra/clang-doc/JSONGenerator.cpp
+++ b/clang-tools-extra/clang-doc/JSONGenerator.cpp
@@ -147,8 +147,10 @@ static Object serializeComment(const CommentInfo &I, Object &Description) {
Child.insert({"ParamName", I.ParamName});
Child.insert({"Direction", I.Direction});
Child.insert({"Explicit", I.Explicit});
- Child.insert({"Children", ChildArr});
- Obj.insert({commentKindToString(I.Kind), ChildVal});
+ auto TextCommentsArray = extractTextComments(CARef.front().getAsObject());
+ Child.insert({"Children", TextCommentsArray});
+ if (I.Kind == CommentKind::CK_ParamCommandComment)
+ insertComment(Description, ChildVal, "ParamComments");
return Obj;
}
diff --git a/clang-tools-extra/clang-doc/assets/comment-template.mustache b/clang-tools-extra/clang-doc/assets/comment-template.mustache
index f2edb1b2eb9ac..d55a53194ee5c 100644
--- a/clang-tools-extra/clang-doc/assets/comment-template.mustache
+++ b/clang-tools-extra/clang-doc/assets/comment-template.mustache
@@ -24,6 +24,14 @@
{{>Comments}}
{{/Children}}
{{/ParagraphComment}}
+{{#HasParamComments}}
+ <h3>Parameters</h3>
+ {{#ParamComments}}
+ <div>
+ <b>{{ParamName}}</b> {{#Explicit}}{{Direction}}{{/Explicit}} {{#Children}}{{>Comments}}{{/Children}}
+ </div>
+ {{/ParamComments}}
+{{/HasParamComments}}
{{#BlockCommandComment}}
<div class="block-command-comment__command">
<div class="block-command-command">
diff --git a/clang-tools-extra/test/clang-doc/basic-project.mustache.test b/clang-tools-extra/test/clang-doc/basic-project.mustache.test
index 4cf8bad32fd9d..b55e0abe2cdef 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.mustache.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.mustache.test
@@ -260,6 +260,23 @@ HTML-CALC: </div>
HTML-CALC: <div>
HTML-CALC: <p></p>
HTML-CALC: </div>
+HTML-CALC: <h3>Parameters</h3>
+HTML-CALC: <div>
+HTML-CALC: <b>a</b> <div>
+HTML-CALC: <p> First integer.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></p>
+HTML-CALC: </div>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <b>b</b> <div>
+HTML-CALC: <p> Second integer.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></p>
+HTML-CALC: </div>
+HTML-CALC: </div>
HTML-CALC: </div>
HTML-CALC: </div>
HTML-CALC: </div>
@@ -300,6 +317,23 @@ HTML-CALC: </div>
HTML-CALC: <div>
HTML-CALC: <p></p>
HTML-CALC: </div>
+HTML-CALC: <h3>Parameters</h3>
+HTML-CALC: <div>
+HTML-CALC: <b>a</b> <div>
+HTML-CALC: <p> First integer.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></p>
+HTML-CALC: </div>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <b>b</b> <div>
+HTML-CALC: <p> Second integer.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></p>
+HTML-CALC: </div>
+HTML-CALC: </div>
HTML-CALC: </div>
HTML-CALC: </div>
HTML-CALC: </div>
@@ -320,6 +354,23 @@ HTML-CALC: </div>
HTML-CALC: <div>
HTML-CALC: <p></p>
HTML-CALC: </div>
+HTML-CALC: <h3>Parameters</h3>
+HTML-CALC: <div>
+HTML-CALC: <b>a</b> <div>
+HTML-CALC: <p> First integer.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></p>
+HTML-CALC: </div>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <b>b</b> <div>
+HTML-CALC: <p> Second integer.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></p>
+HTML-CALC: </div>
+HTML-CALC: </div>
HTML-CALC: </div>
HTML-CALC: </div>
HTML-CALC: </div>
@@ -340,6 +391,23 @@ HTML-CALC: </div>
HTML-CALC: <div>
HTML-CALC: <p></p>
HTML-CALC: </div>
+HTML-CALC: <h3>Parameters</h3>
+HTML-CALC: <div>
+HTML-CALC: <b>a</b> <div>
+HTML-CALC: <p> First integer.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></p>
+HTML-CALC: </div>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <b>b</b> <div>
+HTML-CALC: <p> Second integer.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></p>
+HTML-CALC: </div>
+HTML-CALC: </div>
HTML-CALC: </div>
HTML-CALC: </div>
HTML-CALC: </div>
@@ -439,6 +507,20 @@ HTML-RECTANGLE: </div>
HTML-RECTANGLE: <div>
HTML-RECTANGLE: <p></p>
HTML-RECTANGLE: </div>
+HTML-RECTANGLE: <h3>Parameters</h3>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <b>width</b> <div>
+HTML-RECTANGLE: <p> Width of the rectangle.</p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p></p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <b>height</b> <div>
+HTML-RECTANGLE: <p> Height of the rectangle.</p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
@@ -578,6 +660,12 @@ HTML-CIRCLE: </div>
HTML-CIRCLE: <div>
HTML-CIRCLE: <p></p>
HTML-CIRCLE: </div>
+HTML-CIRCLE: <h3>Parameters</h3>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <b>radius</b> <div>
+HTML-CIRCLE: <p> Radius of the circle.</p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
|
This is a squashed version of #150470 |
158802a
to
cef7188
Compare
Serializes parameter comments for all descriptions. We do not support Doxygen's parameter checking, which warns if a documented parameter is not actually present.
cef7188
to
17db501
Compare
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/20386 Here is the relevant piece of the build log for the reference
|
Serializes parameter comments for all descriptions. We do not support Doxygen's parameter checking, which warns if a documented parameter is not actually present.
Serializes parameter comments for all descriptions. We do not support Doxygen's parameter checking, which warns if a documented parameter is not actually present.
Serializes parameter comments for all descriptions.
We do not support Doxygen's parameter checking, which warns if a documented parameter is not actually present.