diff --git a/clang-tools-extra/clang-doc/JSONGenerator.cpp b/clang-tools-extra/clang-doc/JSONGenerator.cpp index fab54591b8faa..ad76c40d49db8 100644 --- a/clang-tools-extra/clang-doc/JSONGenerator.cpp +++ b/clang-tools-extra/clang-doc/JSONGenerator.cpp @@ -628,7 +628,7 @@ static void serializeInfo(const RecordInfo &I, json::Object &Obj, if (!PubFunctionsArrayRef.empty()) insertArray(Obj, PubFunctionsArray, "PublicFunctions"); if (!ProtFunctionsArrayRef.empty()) - Obj["ProtectedFunctions"] = ProtFunctionsArray; + insertArray(Obj, ProtFunctionsArray, "ProtectedFunctions"); } if (!I.Members.empty()) { diff --git a/clang-tools-extra/clang-doc/assets/class-template.mustache b/clang-tools-extra/clang-doc/assets/class-template.mustache index 19e6e6adf1b44..ef5a7572a3f48 100644 --- a/clang-tools-extra/clang-doc/assets/class-template.mustache +++ b/clang-tools-extra/clang-doc/assets/class-template.mustache @@ -63,22 +63,22 @@ {{/HasPublicFunctions}} - {{#ProtectedFunction}} + {{#HasProtectedFunctions}}
  • - Protected Method + Protected Methods
  • - {{/ProtectedFunction}} + {{/HasProtectedFunctions}} {{#HasEnums}}
  • @@ -198,18 +198,16 @@ {{/PublicFunctions}} {{/PublicFunctions}} - {{#ProtectedFunction}} - - - {{/ProtectedFunction}} + {{#HasProtectedFunctions}} +
    +

    Protected Methods

    +
    + {{#ProtectedFunctions}} + {{>FunctionPartial}} + {{/ProtectedFunctions}} +
    +
    + {{/HasProtectedFunctions}} {{#HasEnums}}

    Enumerations

    diff --git a/clang-tools-extra/test/clang-doc/json/class.cpp b/clang-tools-extra/test/clang-doc/json/class.cpp index 6356aee14c16c..5c63aa5ec45ef 100644 --- a/clang-tools-extra/test/clang-doc/json/class.cpp +++ b/clang-tools-extra/test/clang-doc/json/class.cpp @@ -170,6 +170,7 @@ struct MyClass { // CHECK-NEXT: "HasEnums": true, // CHECK-NEXT: "HasFriends": true, // CHECK-NEXT: "HasPrivateMembers": true, +// CHECK-NEXT: "HasProtectedFunctions": true, // CHECK-NEXT: "HasProtectedMembers": true, // CHECK-NEXT: "HasPublicFunctions": true, // CHECK-NEXT: "HasPublicMembers": true, @@ -329,6 +330,15 @@ struct MyClass { // HTML-NEXT: // HTML-NEXT: // HTML-NEXT:
    +// HTML:
    +// HTML-NEXT:

    Protected Methods

    +// HTML-NEXT:
    +// HTML-NEXT:
    +// HTML-NEXT:
    int protectedMethod ()
    +// HTML-NEXT:

    Defined at line of file

    +// HTML-NEXT:
    +// HTML-NEXT:
    +// HTML-NEXT:
    // HTML:
    // HTML-NEXT:

    Inner Classes

    // HTML-NEXT: