-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[clang-doc] Serialize "IsStatic" for fields #171698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
evelez7
merged 1 commit into
main
from
users/evelez7/clang-doc-serialize-static-for-members
Dec 11, 2025
Merged
[clang-doc] Serialize "IsStatic" for fields #171698
evelez7
merged 1 commit into
main
from
users/evelez7/clang-doc-serialize-static-for-members
Dec 11, 2025
+8
−3
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Dec 10, 2025
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Dec 10, 2025
Member
Author
602d10e to
dc830ae
Compare
🐧 Linux x64 Test Results
✅ The build succeeded and all tests passed. |
🪟 Windows x64 Test Results
✅ The build succeeded and all tests passed. |
Member
|
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesFull diff: https://github.com/llvm/llvm-project/pull/171698.diff 5 Files Affected:
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 @@
<div>
{{#PublicMembers}}
<div id="{{Name}}" class="delimiter-container">
- <pre><code class="language-cpp code-clang-doc" >{{Type}} {{Name}}</code></pre>
+ <pre><code class="language-cpp code-clang-doc" >{{#IsStatic}}static {{/IsStatic}}{{Type}} {{Name}}</code></pre>
{{#MemberComments}}
<div>
{{>Comments}}
@@ -171,7 +171,7 @@
<div>
{{#Obj}}
<div id="{{Name}}" class="delimiter-container">
- <pre><code class="language-cpp code-clang-doc" >{{Type}} {{Name}}</code></pre>
+ <pre><code class="language-cpp code-clang-doc" >{{#IsStatic}}static {{/IsStatic}}{{Type}} {{Name}}</code></pre>
{{#MemberComments}}
<div>
{{>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: <div id="public_val" class="delimiter-container">
HTML-CALC: <pre><code class="language-cpp code-clang-doc" >int public_val</code></pre>
HTML-CALC: </div>
HTML-CALC: <div id="static_val" class="delimiter-container">
-HTML-CALC: <pre><code class="language-cpp code-clang-doc" >const int static_val</code></pre>
+HTML-CALC: <pre><code class="language-cpp code-clang-doc" >static const int static_val</code></pre>
HTML-CALC: </div>
HTML-CALC: </div>
HTML-CALC: </section>
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"
}
|
petrhosek
approved these changes
Dec 11, 2025
Base automatically changed from
users/evelez7/clang-doc-indent-templates
to
main
December 11, 2025 16:49
dc830ae to
85b0b75
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

No description provided.