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 @@ {{/CodeComments}} {{/HasCodeComments}} +{{#HasThrowsComments}} +
Returns
HTML-CALC:double The result of a / b.
HTML-CALC: +HTML-CALC:Throws
+HTML-CALC:if b is zero.
HTML-CALC: