diff --git a/clang-tools-extra/clang-doc/JSONGenerator.cpp b/clang-tools-extra/clang-doc/JSONGenerator.cpp index 5fc28406ee870..cae1a686266c6 100644 --- a/clang-tools-extra/clang-doc/JSONGenerator.cpp +++ b/clang-tools-extra/clang-doc/JSONGenerator.cpp @@ -126,6 +126,8 @@ static Object serializeComment(const CommentInfo &I, Object &Description) { auto TextCommentsArray = extractTextComments(CARef.front().getAsObject()); if (I.Name == "brief") insertComment(Description, TextCommentsArray, "BriefComments"); + else if (I.Name == "return") + insertComment(Description, TextCommentsArray, "ReturnComments"); 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 d55a53194ee5c..89c48d26278c0 100644 --- a/clang-tools-extra/clang-doc/assets/comment-template.mustache +++ b/clang-tools-extra/clang-doc/assets/comment-template.mustache @@ -32,6 +32,14 @@ {{/ParamComments}} {{/HasParamComments}} +{{#HasReturnComments}} +

Returns

+ {{#ReturnComments}} + {{#.}} +

{{TextComment}}

+ {{/.}} + {{/ReturnComments}} +{{/HasReturnComments}} {{#BlockCommandComment}}
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 b55e0abe2cdef..2c87fe2533195 100644 --- a/clang-tools-extra/test/clang-doc/basic-project.mustache.test +++ b/clang-tools-extra/test/clang-doc/basic-project.mustache.test @@ -93,6 +93,8 @@ HTML-SHAPE:
HTML-SHAPE:
HTML-SHAPE:

HTML-SHAPE:
+HTML-SHAPE:

Returns

+HTML-SHAPE:

double The area of the shape.

HTML-SHAPE:
HTML-SHAPE: HTML-SHAPE: @@ -113,6 +115,8 @@ HTML-SHAPE: HTML-SHAPE:
HTML-SHAPE:

HTML-SHAPE:
+HTML-SHAPE:

Returns

+HTML-SHAPE:

double The perimeter of the shape.

HTML-SHAPE: HTML-SHAPE: HTML-SHAPE: @@ -277,6 +281,8 @@ HTML-CALC:
HTML-CALC:

HTML-CALC:
HTML-CALC: +HTML-CALC:

Returns

+HTML-CALC:

int The sum of a and b.

HTML-CALC: HTML-CALC: HTML-CALC: @@ -297,6 +303,8 @@ HTML-CALC: HTML-CALC:
HTML-CALC:

HTML-CALC:
+HTML-CALC:

Returns

+HTML-CALC:

int The result of a - b.

HTML-CALC: HTML-CALC: HTML-CALC: @@ -334,6 +342,8 @@ HTML-CALC:
HTML-CALC:

HTML-CALC:
HTML-CALC: +HTML-CALC:

Returns

+HTML-CALC:

int The product of a and b.

HTML-CALC: HTML-CALC: HTML-CALC: @@ -371,6 +381,9 @@ HTML-CALC:
HTML-CALC:

HTML-CALC:
HTML-CALC: +HTML-CALC:

Returns

+HTML-CALC:

double The result of a / b.

+HTML-CALC:

HTML-CALC: HTML-CALC: HTML-CALC: @@ -408,6 +421,8 @@ HTML-CALC:
HTML-CALC:

HTML-CALC:
HTML-CALC: +HTML-CALC:

Returns

+HTML-CALC:

The result of a % b.

HTML-CALC: HTML-CALC: HTML-CALC: @@ -541,6 +556,8 @@ HTML-RECTANGLE: HTML-RECTANGLE:
HTML-RECTANGLE:

HTML-RECTANGLE:
+HTML-RECTANGLE:

Returns

+HTML-RECTANGLE:

double The area of the rectangle.

HTML-RECTANGLE: HTML-RECTANGLE: HTML-RECTANGLE: @@ -561,6 +578,8 @@ HTML-RECTANGLE: HTML-RECTANGLE:
HTML-RECTANGLE:

HTML-RECTANGLE:
+HTML-RECTANGLE:

Returns

+HTML-RECTANGLE:

double The perimeter of the rectangle.

HTML-RECTANGLE: HTML-RECTANGLE: HTML-RECTANGLE: @@ -686,6 +705,8 @@ HTML-CIRCLE: HTML-CIRCLE:
HTML-CIRCLE:

HTML-CIRCLE:
+HTML-CIRCLE:

Returns

+HTML-CIRCLE:

double The area of the circle.

HTML-CIRCLE: HTML-CIRCLE: HTML-CIRCLE: @@ -706,6 +727,8 @@ HTML-CIRCLE: HTML-CIRCLE:
HTML-CIRCLE:

HTML-CIRCLE:
+HTML-CIRCLE:

Returns

+HTML-CIRCLE:

double The perimeter of the circle.

HTML-CIRCLE: HTML-CIRCLE: HTML-CIRCLE: