-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[clang-doc] generate comments for functions #150570
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Change the function partial to enable comments to be generated for functions. This only enables the brief comments in the basic project.
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesChange the function partial to enable comments to be generated for Full diff: https://github.com/llvm/llvm-project/pull/150570.diff 2 Files Affected:
diff --git a/clang-tools-extra/clang-doc/assets/function-template.mustache b/clang-tools-extra/clang-doc/assets/function-template.mustache
index 6683afa03ea43..2510a4de2cd68 100644
--- a/clang-tools-extra/clang-doc/assets/function-template.mustache
+++ b/clang-tools-extra/clang-doc/assets/function-template.mustache
@@ -14,10 +14,10 @@
</code>
</pre>
{{! Function Comments }}
- {{#FunctionComments}}
+ {{#Description}}
<div>
{{>Comments}}
</div>
- {{/FunctionComments}}
+ {{/Description}}
</div>
</div>
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 4fb38e2b32fcb..4cf8bad32fd9d 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.mustache.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.mustache.test
@@ -83,6 +83,17 @@ HTML-SHAPE: <code class="language-cpp code-clang-doc">
HTML-SHAPE: double area ()
HTML-SHAPE: </code>
HTML-SHAPE: </pre>
+HTML-SHAPE: <div>
+HTML-SHAPE: <div>
+HTML-SHAPE: <p> Calculates the area of the shape.</p>
+HTML-SHAPE: </div>
+HTML-SHAPE: <div>
+HTML-SHAPE: <p></p>
+HTML-SHAPE: </div>
+HTML-SHAPE: <div>
+HTML-SHAPE: <p></p>
+HTML-SHAPE: </div>
+HTML-SHAPE: </div>
HTML-SHAPE: </div>
HTML-SHAPE: </div>
HTML-SHAPE: <div class="delimiter-container">
@@ -92,6 +103,17 @@ HTML-SHAPE: <code class="language-cpp code-clang-doc">
HTML-SHAPE: double perimeter ()
HTML-SHAPE: </code>
HTML-SHAPE: </pre>
+HTML-SHAPE: <div>
+HTML-SHAPE: <div>
+HTML-SHAPE: <p> Calculates the perimeter of the shape.</p>
+HTML-SHAPE: </div>
+HTML-SHAPE: <div>
+HTML-SHAPE: <p></p>
+HTML-SHAPE: </div>
+HTML-SHAPE: <div>
+HTML-SHAPE: <p></p>
+HTML-SHAPE: </div>
+HTML-SHAPE: </div>
HTML-SHAPE: </div>
HTML-SHAPE: </div>
HTML-SHAPE: <div class="delimiter-container">
@@ -101,6 +123,14 @@ HTML-SHAPE: <code class="language-cpp code-clang-doc">
HTML-SHAPE: void ~Shape ()
HTML-SHAPE: </code>
HTML-SHAPE: </pre>
+HTML-SHAPE: <div>
+HTML-SHAPE: <div>
+HTML-SHAPE: <p> Virtual destructor.</p>
+HTML-SHAPE: </div>
+HTML-SHAPE: <div>
+HTML-SHAPE: <p></p>
+HTML-SHAPE: </div>
+HTML-SHAPE: </div>
HTML-SHAPE: </div>
HTML-SHAPE: </div>
HTML-SHAPE: </div>
@@ -220,6 +250,17 @@ HTML-CALC: <code class="language-cpp code-clang-doc">
HTML-CALC: int add (int a, int b)
HTML-CALC: </code>
HTML-CALC: </pre>
+HTML-CALC: <div>
+HTML-CALC: <div>
+HTML-CALC: <p> Adds two integers.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></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 class="delimiter-container">
@@ -229,6 +270,17 @@ HTML-CALC: <code class="language-cpp code-clang-doc">
HTML-CALC: int subtract (int a, int b)
HTML-CALC: </code>
HTML-CALC: </pre>
+HTML-CALC: <div>
+HTML-CALC: <div>
+HTML-CALC: <p> Subtracts the second integer from the first.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></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 class="delimiter-container">
@@ -238,6 +290,17 @@ HTML-CALC: <code class="language-cpp code-clang-doc">
HTML-CALC: int multiply (int a, int b)
HTML-CALC: </code>
HTML-CALC: </pre>
+HTML-CALC: <div>
+HTML-CALC: <div>
+HTML-CALC: <p> Multiplies two integers.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></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 class="delimiter-container">
@@ -247,6 +310,17 @@ HTML-CALC: <code class="language-cpp code-clang-doc">
HTML-CALC: double divide (int a, int b)
HTML-CALC: </code>
HTML-CALC: </pre>
+HTML-CALC: <div>
+HTML-CALC: <div>
+HTML-CALC: <p> Divides the first integer by the second.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></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 class="delimiter-container">
@@ -256,6 +330,17 @@ HTML-CALC: <code class="language-cpp code-clang-doc">
HTML-CALC: int mod (int a, int b)
HTML-CALC: </code>
HTML-CALC: </pre>
+HTML-CALC: <div>
+HTML-CALC: <div>
+HTML-CALC: <p> Performs the mod operation on integers.</p>
+HTML-CALC: </div>
+HTML-CALC: <div>
+HTML-CALC: <p></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>
@@ -344,6 +429,17 @@ HTML-RECTANGLE: <code class="language-cpp code-clang-doc">
HTML-RECTANGLE: void Rectangle (double width, double height)
HTML-RECTANGLE: </code>
HTML-RECTANGLE: </pre>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p> Constructs a new Rectangle object.</p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p></p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p></p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
HTML-RECTANGLE: <div class="delimiter-container">
@@ -353,6 +449,17 @@ HTML-RECTANGLE: <code class="language-cpp code-clang-doc">
HTML-RECTANGLE: double area ()
HTML-RECTANGLE: </code>
HTML-RECTANGLE: </pre>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p> Calculates the area of the rectangle.</p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p></p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p></p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
HTML-RECTANGLE: <div class="delimiter-container">
@@ -362,6 +469,17 @@ HTML-RECTANGLE: <code class="language-cpp code-clang-doc">
HTML-RECTANGLE: double perimeter ()
HTML-RECTANGLE: </code>
HTML-RECTANGLE: </pre>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p> Calculates the perimeter of the rectangle.</p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p></p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: <div>
+HTML-RECTANGLE: <p></p>
+HTML-RECTANGLE: </div>
+HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
HTML-RECTANGLE: </div>
@@ -450,6 +568,17 @@ HTML-CIRCLE: <code class="language-cpp code-clang-doc">
HTML-CIRCLE: void Circle (double radius)
HTML-CIRCLE: </code>
HTML-CIRCLE: </pre>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <p> Constructs a new Circle object.</p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <p></p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <p></p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
HTML-CIRCLE: <div class="delimiter-container">
@@ -459,6 +588,17 @@ HTML-CIRCLE: <code class="language-cpp code-clang-doc">
HTML-CIRCLE: double area ()
HTML-CIRCLE: </code>
HTML-CIRCLE: </pre>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <p> Calculates the area of the circle.</p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <p></p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <p></p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
HTML-CIRCLE: <div class="delimiter-container">
@@ -468,6 +608,17 @@ HTML-CIRCLE: <code class="language-cpp code-clang-doc">
HTML-CIRCLE: double perimeter ()
HTML-CIRCLE: </code>
HTML-CIRCLE: </pre>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <p> Calculates the perimeter of the circle.</p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <p></p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: <div>
+HTML-CIRCLE: <p></p>
+HTML-CIRCLE: </div>
+HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
HTML-CIRCLE: </div>
|
This is a squashed version of #150468 |
This was referenced Jul 25, 2025
ilovepi
approved these changes
Jul 25, 2025
mahesh-attarde
pushed a commit
to mahesh-attarde/llvm-project
that referenced
this pull request
Jul 28, 2025
Change the function partial to enable comments to be generated for functions. This only enables the brief comments in the basic project.
ajaden-codes
pushed a commit
to Jaddyen/llvm-project
that referenced
this pull request
Jul 28, 2025
Change the function partial to enable comments to be generated for functions. This only enables the brief comments in the basic project.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change the function partial to enable comments to be generated for
functions. This only enables the brief comments in the basic project.