llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) <details> <summary>Changes</summary> This is mostly a chore patch that fixes misnamed, mismatched, or non-existant tags. That includes renaming the function tags in the class template to `Has*Methods` instead of `Has*Functions`. The "method" style was already preferred in the template HTML. Some extraneous tags were removed from the enum template. All templates should use `Description` for rendering comments, but it was still using an old tag name. Also, the JSON generator currently doesn't serialize individual enum value comments, so that tag was removed. Same for public members. `Description` is removed for friends due to the way Mustache handles missing tags. If `Description` isn't present, it will use the parent's description which is undesirable. --- Patch is 30.45 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/175112.diff 16 Files Affected: - (modified) clang-tools-extra/clang-doc/JSONGenerator.cpp (+2-2) - (modified) clang-tools-extra/clang-doc/assets/alias-template.mustache (+1-1) - (modified) clang-tools-extra/clang-doc/assets/class-template.mustache (+21-29) - (modified) clang-tools-extra/clang-doc/assets/comment-template.mustache (+1-1) - (modified) clang-tools-extra/clang-doc/assets/enum-template.mustache (+4-12) - (modified) clang-tools-extra/clang-doc/assets/index-template.mustache (+3-3) - (modified) clang-tools-extra/clang-doc/assets/namespace-template.mustache (+3-3) - (modified) clang-tools-extra/test/clang-doc/basic-project.mustache.test (+4-4) - (modified) clang-tools-extra/test/clang-doc/enum.cpp (+5) - (modified) clang-tools-extra/test/clang-doc/index.cpp (+5-5) - (modified) clang-tools-extra/test/clang-doc/json/class-template.cpp (+8-3) - (modified) clang-tools-extra/test/clang-doc/json/class.cpp (+17-23) - (modified) clang-tools-extra/test/clang-doc/json/method-template.cpp (+1-1) - (modified) clang-tools-extra/test/clang-doc/mustache-index.cpp (+4-4) - (modified) clang-tools-extra/test/clang-doc/namespace.cpp (+4-4) - (modified) clang-tools-extra/unittests/clang-doc/JSONGeneratorTest.cpp (+11-11) ``````````diff diff --git a/clang-tools-extra/clang-doc/JSONGenerator.cpp b/clang-tools-extra/clang-doc/JSONGenerator.cpp index ad76c40d49db8..d3138af7f6474 100644 --- a/clang-tools-extra/clang-doc/JSONGenerator.cpp +++ b/clang-tools-extra/clang-doc/JSONGenerator.cpp @@ -626,9 +626,9 @@ static void serializeInfo(const RecordInfo &I, json::Object &Obj, } if (!PubFunctionsArrayRef.empty()) - insertArray(Obj, PubFunctionsArray, "PublicFunctions"); + insertArray(Obj, PubFunctionsArray, "PublicMethods"); if (!ProtFunctionsArrayRef.empty()) - insertArray(Obj, ProtFunctionsArray, "ProtectedFunctions"); + insertArray(Obj, ProtFunctionsArray, "ProtectedMethods"); } if (!I.Members.empty()) { diff --git a/clang-tools-extra/clang-doc/assets/alias-template.mustache b/clang-tools-extra/clang-doc/assets/alias-template.mustache index 9b32f132e9ef3..0977233cbf15a 100644 --- a/clang-tools-extra/clang-doc/assets/alias-template.mustache +++ b/clang-tools-extra/clang-doc/assets/alias-template.mustache @@ -2,7 +2,7 @@ {{#Template}} <pre><code class="language-cpp code-clang-doc">template <{{#Parameters}}{{Param}}{{^End}}, {{/End}}{{/Parameters}}></code></pre> {{/Template}} - <pre><code class="language-cpp code-clang-doc">{{#IsUsing}}using{{/IsUsing}}{{^IsUsing}}typedef{{/IsUsing}} {{Name}}{{#IsUsing}} ={{/Isusing}} {{#Underlying}}{{Name}}{{/Underlying}}</code></pre> + <pre><code class="language-cpp code-clang-doc">{{#IsUsing}}using{{/IsUsing}}{{^IsUsing}}typedef{{/IsUsing}} {{Name}}{{#IsUsing}} ={{/IsUsing}}{{#Underlying}} {{Name}}{{/Underlying}}</code></pre> {{#Description}} {{>Comments}} {{/Description}} diff --git a/clang-tools-extra/clang-doc/assets/class-template.mustache b/clang-tools-extra/clang-doc/assets/class-template.mustache index ef5a7572a3f48..8ff892ecef760 100644 --- a/clang-tools-extra/clang-doc/assets/class-template.mustache +++ b/clang-tools-extra/clang-doc/assets/class-template.mustache @@ -47,38 +47,38 @@ </details> </li> {{/HasProtectedMembers}} - {{#HasPublicFunctions}} + {{#HasPublicMethods}} <li> <details open> <summary class="sidebar-section"> - <a class="sidebar-item" href="#PublicMethods">Public Method</a> + <a class="sidebar-item" href="#PublicMethods">Public Methods</a> </summary> <ul> - {{#PublicFunctions}} + {{#PublicMethods}} <li class="sidebar-item-container"> <a class="sidebar-item" href="#{{USR}}">{{Name}}</a> </li> - {{/PublicFunctions}} + {{/PublicMethods}} </ul> </details> </li> - {{/HasPublicFunctions}} - {{#HasProtectedFunctions}} + {{/HasPublicMethods}} + {{#HasProtectedMethods}} <li> <details open> <summary class="sidebar-section"> <a class="sidebar-item" href="#ProtectedMethods">Protected Methods</a> </summary> <ul> - {{#ProtectedFunctions}} + {{#ProtectedMethods}} <li class="sidebar-item-container"> <a class="sidebar-item" href="#{{USR}}">{{Name}}</a> </li> - {{/ProtectedFunctions}} + {{/ProtectedMethods}} </ul> </details> </li> - {{/HasProtectedFunctions}} + {{/HasProtectedMethods}} {{#HasEnums}} <li> <details open> @@ -115,7 +115,7 @@ <li> <details open> <summary class="sidebar-section"> - <a class="sidebar-item" href="#Classes">Inner Classes</a> + <a class="sidebar-item" href="#Records">Records</a> </summary> <ul> {{#Records}} @@ -142,7 +142,7 @@ </ul> </details> </li> - {{/HasRecords}} + {{/HasFriends}} </ul> </div> <div class="resizer" id="resizer"></div> @@ -168,11 +168,6 @@ {{#PublicMembers}} <div id="{{Name}}" class="delimiter-container"> <pre><code class="language-cpp code-clang-doc" >{{#IsStatic}}static {{/IsStatic}}{{Type}} {{Name}}</code></pre> - {{#MemberComments}} - <div> - {{>Comments}} - </div> - {{/MemberComments}} </div> {{/PublicMembers}} </div> @@ -190,24 +185,24 @@ </div> </section> {{/HasProtectedMembers}} - {{#HasPublicFunctions}} + {{#HasPublicMethods}} <section id="PublicMethods" class="section-container"> <h2>Public Methods</h2> - {{#PublicFunctions}} + {{#PublicMethods}} {{>FunctionPartial}} - {{/PublicFunctions}} + {{/PublicMethods}} </section> - {{/PublicFunctions}} - {{#HasProtectedFunctions}} + {{/HasPublicMethods}} + {{#HasProtectedMethods}} <section id="ProtectedMethods" class="section-container"> <h2>Protected Methods</h2> <div> - {{#ProtectedFunctions}} + {{#ProtectedMethods}} {{>FunctionPartial}} - {{/ProtectedFunctions}} + {{/ProtectedMethods}} </div> </section> - {{/HasProtectedFunctions}} + {{/HasProtectedMethods}} {{#HasEnums}} <section id="Enums" class="section-container"> <h2>Enumerations</h2> @@ -217,8 +212,8 @@ </section> {{/HasEnums}} {{#HasRecords}} - <section id="Classes" class="section-container"> - <h2>Inner Classes</h2> + <section id="Records" class="section-container"> + <h2>Records</h2> <ul class="class-container"> {{#Records}} <li id="{{USR}}" style="max-height: 40px;"> @@ -252,9 +247,6 @@ {{^IsClass}} <pre><code class="language-cpp code-clang-doc">{{ReturnType.Name}} {{Name}}{{#Template}}{{#Specialization}}<{{#Parameters}}{{Param}}{{^End}}, {{/End}}{{/Parameters}}>{{/Specialization}}{{/Template}} ({{#Params}}{{Type.QualName}} {{Name}}{{^End}}, {{/End}}{{/Params}})</code></pre> {{/IsClass}} - {{#.Description}} - {{>Comments}} - {{/.Description}} </div> {{/Friends}} </section> diff --git a/clang-tools-extra/clang-doc/assets/comment-template.mustache b/clang-tools-extra/clang-doc/assets/comment-template.mustache index 23bd1bfee4f80..11419cce49eb0 100644 --- a/clang-tools-extra/clang-doc/assets/comment-template.mustache +++ b/clang-tools-extra/clang-doc/assets/comment-template.mustache @@ -42,7 +42,7 @@ <b>{{ParamName}}</b> {{#Explicit}}{{Direction}}{{/Explicit}} {{#Children}}{{TextComment}}{{/Children}} </div> </div> -{{/#TParamComments}} +{{/TParamComments}} {{/HasTParamComments}} {{#HasReturnComments}} <div class="nested-delimiter-container"> diff --git a/clang-tools-extra/clang-doc/assets/enum-template.mustache b/clang-tools-extra/clang-doc/assets/enum-template.mustache index af1364c4d37f6..cfba6588f0aa7 100644 --- a/clang-tools-extra/clang-doc/assets/enum-template.mustache +++ b/clang-tools-extra/clang-doc/assets/enum-template.mustache @@ -15,9 +15,6 @@ <tr> <th>Name</th> <th>Value</th> - {{#HasComment}} - <th>Comment</th> - {{/HasComment}} </tr> {{#Members}} <tr> @@ -29,21 +26,16 @@ {{^Value}} <td>{{ValueExpr}}</td> {{/Value}} - {{#EnumValueComments}} - <td>{{>Comments}}</td> - {{/EnumValueComments}} </tr> {{/Members}} </tbody> </table> - {{#EnumComments}} - <div> + {{#Description}} + <div class="doc-card"> {{>Comments}} </div> - {{/EnumComments}} + {{/Description}} {{#Location}} - <div> - Defined at line {{LineNumber}} of file {{Filename}} - </div> + <p>Defined at line {{LineNumber}} of file {{Filename}}</p> {{/Location}} </div> diff --git a/clang-tools-extra/clang-doc/assets/index-template.mustache b/clang-tools-extra/clang-doc/assets/index-template.mustache index cee7df872a0e8..40876e556b97d 100644 --- a/clang-tools-extra/clang-doc/assets/index-template.mustache +++ b/clang-tools-extra/clang-doc/assets/index-template.mustache @@ -11,12 +11,12 @@ <li> <details open> <summary class="sidebar-section"> - <a class="sidebar-item" href="#Namespaces">Namespaces</a> + <a class="sidebar-item" href="#Index">Index</a> </summary> <ul> {{#Index}} <li class="sidebar-item-container"> - <a class="sidebar-item" href="#{{Name}}">{{Name}}</a> + <a class="sidebar-item" href="#{{USR}}">{{Name}}</a> </li> {{/Index}} </ul> @@ -31,7 +31,7 @@ {{#Index}} <div> <a href="{{#Path}}{{Path}}/{{/Path}}{{Name}}/index.html"> - <pre><code class="language-cpp code-clang-doc">namespace {{Name}}</code></pre> + <pre><code id="{{USR}}" class="language-cpp code-clang-doc">namespace {{Name}}</code></pre> </a> </div> {{/Index}} diff --git a/clang-tools-extra/clang-doc/assets/namespace-template.mustache b/clang-tools-extra/clang-doc/assets/namespace-template.mustache index 567af626714ef..0fc5a00642df7 100644 --- a/clang-tools-extra/clang-doc/assets/namespace-template.mustache +++ b/clang-tools-extra/clang-doc/assets/namespace-template.mustache @@ -35,7 +35,7 @@ <li> <details open> <summary class="sidebar-section"> - <a class="sidebar-item" href="#Classes">Inner Classes</a> + <a class="sidebar-item" href="#Records">Records</a> </summary> <ul> {{#Records}} @@ -140,8 +140,8 @@ </section> {{/HasEnums}} {{#HasRecords}} - <section id="Classes" class="section-container"> - <h2>Inner Classes</h2> + <section id="Records" class="section-container"> + <h2>Records</h2> <ul class="class-container"> {{#Records}} <li id="{{USR}}" style="max-height: 40px;"> 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 d1f3e910bb31f..aeb910a6940f1 100644 --- a/clang-tools-extra/test/clang-doc/basic-project.mustache.test +++ b/clang-tools-extra/test/clang-doc/basic-project.mustache.test @@ -42,7 +42,7 @@ HTML-SHAPE: <ul> HTML-SHAPE: <li> HTML-SHAPE: <details open> HTML-SHAPE: <summary class="sidebar-section"> -HTML-SHAPE: <a class="sidebar-item" href="#PublicMethods">Public Method</a> +HTML-SHAPE: <a class="sidebar-item" href="#PublicMethods">Public Methods</a> HTML-SHAPE: </summary> HTML-SHAPE: <ul> HTML-SHAPE: <li class="sidebar-item-container"> @@ -167,7 +167,7 @@ HTML-CALC: </li> HTML-CALC: <li> HTML-CALC: <details open> HTML-CALC: <summary class="sidebar-section"> -HTML-CALC: <a class="sidebar-item" href="#PublicMethods">Public Method</a> +HTML-CALC: <a class="sidebar-item" href="#PublicMethods">Public Methods</a> HTML-CALC: </summary> HTML-CALC: <ul> HTML-CALC: <li class="sidebar-item-container"> @@ -366,7 +366,7 @@ HTML-RECTANGLE: <ul> HTML-RECTANGLE: <li> HTML-RECTANGLE: <details open> HTML-RECTANGLE: <summary class="sidebar-section"> -HTML-RECTANGLE: <a class="sidebar-item" href="#PublicMethods">Public Method</a> +HTML-RECTANGLE: <a class="sidebar-item" href="#PublicMethods">Public Methods</a> HTML-RECTANGLE: </summary> HTML-RECTANGLE: <ul> HTML-RECTANGLE: <li class="sidebar-item-container"> @@ -480,7 +480,7 @@ HTML-CIRCLE: <ul> HTML-CIRCLE: <li> HTML-CIRCLE: <details open> HTML-CIRCLE: <summary class="sidebar-section"> -HTML-CIRCLE: <a class="sidebar-item" href="#PublicMethods">Public Method</a> +HTML-CIRCLE: <a class="sidebar-item" href="#PublicMethods">Public Methods</a> HTML-CIRCLE: </summary> HTML-CIRCLE: <ul> HTML-CIRCLE: <li class="sidebar-item-container"> diff --git a/clang-tools-extra/test/clang-doc/enum.cpp b/clang-tools-extra/test/clang-doc/enum.cpp index ce844ec072564..be202978edc54 100644 --- a/clang-tools-extra/test/clang-doc/enum.cpp +++ b/clang-tools-extra/test/clang-doc/enum.cpp @@ -149,6 +149,11 @@ class Animals { // HTML-ANIMAL-NEXT: </tbody> // HTML-ANIMAL-NEXT: </table> // HTML-ANIMAL-NEXT: <div> +// HTML-ANIMAL-NEXT: <div class="nested-delimiter-container"> +// HTML-ANIMAL-NEXT: <p> specify what animal the class is</p> +// HTML-ANIMAL-NEXT: </div> +// HTML-ANIMAL-NEXT: </div> +// HTML-ANIMAL-NEXT: <div> // HTML-ANIMAL-NEXT: Defined at line 116 of file {{.*}}enum.cpp // HTML-ANIMAL-NEXT: </div> // HTML-ANIMAL-NEXT: </div> diff --git a/clang-tools-extra/test/clang-doc/index.cpp b/clang-tools-extra/test/clang-doc/index.cpp index 5ff183f8d80ad..af72720740fae 100644 --- a/clang-tools-extra/test/clang-doc/index.cpp +++ b/clang-tools-extra/test/clang-doc/index.cpp @@ -30,14 +30,14 @@ namespace inner { // CHECK-HTML-NEXT: <li> // CHECK-HTML-NEXT: <details open> // CHECK-HTML-NEXT: <summary class="sidebar-section"> -// CHECK-HTML-NEXT: <a class="sidebar-item" href="#Namespaces">Namespaces</a> +// CHECK-HTML-NEXT: <a class="sidebar-item" href="#Index">Index</a> // CHECK-HTML-NEXT: </summary> // CHECK-HTML-NEXT: <ul> // CHECK-HTML-NEXT: <li class="sidebar-item-container"> -// CHECK-HTML-NEXT: <a class="sidebar-item" href="#GlobalNamespace">GlobalNamespace</a> +// CHECK-HTML-NEXT: <a class="sidebar-item" href="#{{([0-9A-F]{40})}}">GlobalNamespace</a> // CHECK-HTML-NEXT: </li> // CHECK-HTML-NEXT: <li class="sidebar-item-container"> -// CHECK-HTML-NEXT: <a class="sidebar-item" href="#inner">inner</a> +// CHECK-HTML-NEXT: <a class="sidebar-item" href="#{{([0-9A-F]{40})}}">inner</a> // CHECK-HTML-NEXT: </li> // CHECK-HTML-NEXT: </ul> // CHECK-HTML-NEXT: </details> @@ -50,12 +50,12 @@ namespace inner { // CHECK-HTML-NEXT: <h2>Index</h2> // CHECK-HTML-NEXT: <div> // CHECK-HTML-NEXT: <a href="GlobalNamespace/index.html"> -// CHECK-HTML-NEXT: <pre><code class="language-cpp code-clang-doc">namespace GlobalNamespace</code></pre> +// CHECK-HTML-NEXT: <pre><code id="{{([0-9A-F]{40})}}" class="language-cpp code-clang-doc">namespace GlobalNamespace</code></pre> // CHECK-HTML-NEXT: </a> // CHECK-HTML-NEXT: </div> // CHECK-HTML-NEXT: <div> // CHECK-HTML-NEXT: <a href="inner/index.html"> -// CHECK-HTML-NEXT: <pre><code class="language-cpp code-clang-doc">namespace inner</code></pre> +// CHECK-HTML-NEXT: <pre><code id="{{([0-9A-F]{40})}}" class="language-cpp code-clang-doc">namespace inner</code></pre> // CHECK-HTML-NEXT: </a> // CHECK-HTML-NEXT: </div> // CHECK-HTML-NEXT: </section> diff --git a/clang-tools-extra/test/clang-doc/json/class-template.cpp b/clang-tools-extra/test/clang-doc/json/class-template.cpp index 26234509dc183..67bf910a8e88d 100644 --- a/clang-tools-extra/test/clang-doc/json/class-template.cpp +++ b/clang-tools-extra/test/clang-doc/json/class-template.cpp @@ -8,6 +8,13 @@ template<typename T> struct MyClass { }; // CHECK: "Name": "MyClass", +// CHECK: "PublicMembers": [ +// CHECK-NEXT: { +// CHECK-NEXT: "IsStatic": false, +// CHECK-NEXT: "Name": "MemberTemplate", +// CHECK-NEXT: "Type": "T" +// CHECK-NEXT: } +// CHECK-NEXT: ], // CHECK: "Name": "method", // CHECK: "Params": [ // CHECK-NEXT: { @@ -24,10 +31,8 @@ template<typename T> struct MyClass { // CHECK-NEXT: "IsBuiltIn": false, // CHECK-NEXT: "IsTemplate": true, // CHECK-NEXT: "Name": "T", -// CHECK-NEXT: "QualName": "T" +// CHECK-NEXT: "QualName": "T", // CHECK-NEXT: "USR": "0000000000000000000000000000000000000000" -// CHECK: "Name": "MemberTemplate", -// CHECK: "Type": "T" // CHECK: "Template": { // CHECK-NEXT: "Parameters": [ // CHECK-NEXT: { diff --git a/clang-tools-extra/test/clang-doc/json/class.cpp b/clang-tools-extra/test/clang-doc/json/class.cpp index c4f0b2166a3f8..d9ea023bf6827 100644 --- a/clang-tools-extra/test... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/175112 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
