Skip to content

Commit 72d6048

Browse files
hebastofanquake
authored andcommitted
memusage: Make fields of STL helper structs public
The `stl_tree_node`, `list_node` and `unordered_node` class templates only mimic the layout of the standard library's container nodes, so that `sizeof` yields an estimate of the memory they use. Their fields are never accessed. Since llvm/llvm-project#237374, Clang 24 diagnoses these fields with `-Wunused-private-field`. This change drops the `private:` access specifiers. It does not affect the size or alignment of the structs, as all their fields keep the same access control, and it is consistent with `stl_shared_counter`. Github-Pull: #36869 Rebased-From: b9a6b0c
1 parent 107ecee commit 72d6048

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

‎src/memusage.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ static inline size_t MallocUsage(size_t alloc)
6868
template<typename X>
6969
struct stl_tree_node
7070
{
71-
private:
7271
int color;
7372
void* parent;
7473
void* left;
@@ -165,7 +164,6 @@ static inline size_t DynamicUsage(const std::shared_ptr<X>& p)
165164
template<typename X>
166165
struct list_node
167166
{
168-
private:
169167
void* ptr_next;
170168
void* ptr_prev;
171169
X x;
@@ -180,7 +178,6 @@ static inline size_t DynamicUsage(const std::list<X>& l)
180178
template<typename X>
181179
struct unordered_node : private X
182180
{
183-
private:
184181
void* ptr;
185182
};
186183

0 commit comments

Comments
 (0)