From 85b0b75fca624aaf4a059fa1f1beefa790c5ed64 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Thu, 13 Nov 2025 20:23:17 -0800 Subject: [PATCH] fix unittest --- clang-tools-extra/clang-doc/JSONGenerator.cpp | 1 + clang-tools-extra/clang-doc/assets/class-template.mustache | 4 ++-- clang-tools-extra/test/clang-doc/basic-project.mustache.test | 2 +- clang-tools-extra/test/clang-doc/json/class.cpp | 2 ++ clang-tools-extra/unittests/clang-doc/JSONGeneratorTest.cpp | 2 ++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/clang-tools-extra/clang-doc/JSONGenerator.cpp b/clang-tools-extra/clang-doc/JSONGenerator.cpp index 77aa8794561e4..0253ebf5335da 100644 --- a/clang-tools-extra/clang-doc/JSONGenerator.cpp +++ b/clang-tools-extra/clang-doc/JSONGenerator.cpp @@ -551,6 +551,7 @@ static void serializeInfo(const RecordInfo &I, json::Object &Obj, auto &MemberObj = *MemberVal.getAsObject(); MemberObj["Name"] = Member.Name; MemberObj["Type"] = Member.Type.Name; + MemberObj["IsStatic"] = Member.IsStatic; if (Member.Access == AccessSpecifier::AS_public) PubMembersArrayRef.push_back(MemberVal); diff --git a/clang-tools-extra/clang-doc/assets/class-template.mustache b/clang-tools-extra/clang-doc/assets/class-template.mustache index 1197e76ab553c..22cd5f06894a4 100644 --- a/clang-tools-extra/clang-doc/assets/class-template.mustache +++ b/clang-tools-extra/clang-doc/assets/class-template.mustache @@ -154,7 +154,7 @@
{{#PublicMembers}}
-
{{Type}} {{Name}}
+
{{#IsStatic}}static {{/IsStatic}}{{Type}} {{Name}}
{{#MemberComments}}
{{>Comments}} @@ -171,7 +171,7 @@
{{#Obj}}
-
{{Type}} {{Name}}
+
{{#IsStatic}}static {{/IsStatic}}{{Type}} {{Name}}
{{#MemberComments}}
{{>Comments}} 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 b985a39265de7..d406c9f297960 100644 --- a/clang-tools-extra/test/clang-doc/basic-project.mustache.test +++ b/clang-tools-extra/test/clang-doc/basic-project.mustache.test @@ -204,7 +204,7 @@ HTML-CALC:
HTML-CALC:
int public_val
HTML-CALC:
HTML-CALC:
-HTML-CALC:
const int static_val
+HTML-CALC:
static const int static_val
HTML-CALC:
HTML-CALC:
HTML-CALC: diff --git a/clang-tools-extra/test/clang-doc/json/class.cpp b/clang-tools-extra/test/clang-doc/json/class.cpp index 8bf9402adf054..9d3102a11db9d 100644 --- a/clang-tools-extra/test/clang-doc/json/class.cpp +++ b/clang-tools-extra/test/clang-doc/json/class.cpp @@ -158,6 +158,7 @@ struct MyClass { // CHECK-NEXT: ], // CHECK-NEXT: "ProtectedMembers": [ // CHECK-NEXT: { +// CHECK-NEXT: "IsStatic": false, // CHECK-NEXT: "Name": "ProtectedField", // CHECK-NEXT: "Type": "int" // CHECK-NEXT: } @@ -198,6 +199,7 @@ struct MyClass { // CHECK-NEXT: }, // CHECK: "PublicMembers": [ // CHECK-NEXT: { +// CHECK-NEXT: "IsStatic": false, // CHECK-NEXT: "Name": "PublicField", // CHECK-NEXT: "Type": "int" // CHECK-NEXT: } diff --git a/clang-tools-extra/unittests/clang-doc/JSONGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/JSONGeneratorTest.cpp index bd437553961f6..d5ce34d2b984c 100644 --- a/clang-tools-extra/unittests/clang-doc/JSONGeneratorTest.cpp +++ b/clang-tools-extra/unittests/clang-doc/JSONGeneratorTest.cpp @@ -90,6 +90,7 @@ TEST_F(JSONGeneratorTest, emitRecordJSON) { ], "PublicMembers": [ { + "IsStatic": false, "Name": "N", "Type": "int" } @@ -140,6 +141,7 @@ TEST_F(JSONGeneratorTest, emitRecordJSON) { "Path": "GlobalNamespace", "ProtectedMembers": [ { + "IsStatic": false, "Name": "X", "Type": "int" }