Skip to content

Commit 55c89cb

Browse files
author
Daniel Kroening
committed
introduce class_typet::static_members
This enables tracking static fields of a class, following the same pattern as used for methods.
1 parent 12a3d18 commit 55c89cb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/util/irep_ids.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ IREP_ID_ONE(member_initializers)
400400
IREP_ID_ONE(member_initializer)
401401
IREP_ID_ONE(method_qualifier)
402402
IREP_ID_ONE(methods)
403+
IREP_ID_ONE(static_members)
403404
IREP_ID_ONE(constructor)
404405
IREP_ID_ONE(destructor)
405406
IREP_ID_ONE(bases)

src/util/std_types.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,19 @@ class class_typet:public struct_typet
330330
return (methodst &)(add(ID_methods).get_sub());
331331
}
332332

333+
using static_membert = componentt;
334+
using static_memberst = componentst;
335+
336+
const static_memberst &static_members() const
337+
{
338+
return (const static_memberst &)(find(ID_static_members).get_sub());
339+
}
340+
341+
static_memberst &static_members()
342+
{
343+
return (static_memberst &)(add(ID_static_members).get_sub());
344+
}
345+
333346
bool is_abstract() const
334347
{
335348
return get_bool(ID_abstract);

0 commit comments

Comments
 (0)