-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[clang-doc] add throws comments to comment template #150649
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
Open
evelez7
wants to merge
1
commit into
main
Choose a base branch
from
users/evelez7/clang-doc-throws-comments
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
This was referenced Jul 25, 2025
This was referenced Jul 25, 2025
|
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesSerialize throw Doxygen comments for exceptions. Accepts both \throw and Full diff: https://github.com/llvm/llvm-project/pull/150649.diff 2 Files Affected:
diff --git a/clang-tools-extra/clang-doc/JSONGenerator.cpp b/clang-tools-extra/clang-doc/JSONGenerator.cpp
index 599b381cea60d..2db6451259f60 100644
--- a/clang-tools-extra/clang-doc/JSONGenerator.cpp
+++ b/clang-tools-extra/clang-doc/JSONGenerator.cpp
@@ -140,6 +140,13 @@ static Object serializeComment(const CommentInfo &I, Object &Description) {
insertComment(Description, TextCommentsArray, "BriefComments");
else if (I.Name == "return")
insertComment(Description, TextCommentsArray, "ReturnComments");
+ else if (I.Name == "throws" || I.Name == "throw") {
+ json::Value ThrowsVal = Object();
+ auto &ThrowsObj = *ThrowsVal.getAsObject();
+ ThrowsObj["Exception"] = I.Args.front();
+ ThrowsObj["Children"] = TextCommentsArray;
+ insertComment(Description, ThrowsVal, "ThrowsComments");
+ }
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 4e38e5fb92d18..60a4c70ec0dc4 100644
--- a/clang-tools-extra/clang-doc/assets/comment-template.mustache
+++ b/clang-tools-extra/clang-doc/assets/comment-template.mustache
@@ -54,6 +54,14 @@
</div>
{{/CodeComments}}
{{/HasCodeComments}}
+{{#HasThrowsComments}}
+ <h3>Throws</h3>
+ {{#ThrowsComments}}
+ <div>
+ <b>{{ThrowName}}</b> {{#Children}}{{>Comments}}{{/Children}}
+ </div>
+ {{/ThrowsComments}}
+{{/HasThrowsComments}}
{{#BlockCommandComment}}
<div class="block-command-comment__command">
<div class="block-command-command">
|
26f70f8 to
e736a45
Compare
9543783 to
7d6c38c
Compare
e736a45 to
ff3d3ad
Compare
7d6c38c to
e8795d0
Compare
ff3d3ad to
eb95d56
Compare
1ef0736 to
3dbfb45
Compare
ilovepi
reviewed
Jul 25, 2025
3dbfb45 to
9c3d458
Compare
Serialize throw Doxygen comments for exceptions. Accepts both \throw and \throws.
eb95d56 to
35762dd
Compare
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.

Serialize throw Doxygen comments for exceptions. Accepts both \throw and
\throws.