File tree 2 files changed +23
-17
lines changed
2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change 8
8
9
9
#include " std_expr.h"
10
10
11
+ #include < util/namespace.h>
12
+
11
13
#include < cassert>
12
14
13
15
#include " arith_tools.h"
@@ -167,3 +169,22 @@ address_of_exprt::address_of_exprt(const exprt &_op):
167
169
unary_exprt(ID_address_of, _op, pointer_type(_op.type()))
168
170
{
169
171
}
172
+
173
+ // / \return The expression for a named component of this struct.
174
+ exprt &struct_exprt::component (const irep_idt &name, const namespacet &ns)
175
+ {
176
+ const auto index = to_struct_type (ns.follow (type ())).component_number (name);
177
+ DATA_INVARIANT (
178
+ index < operands ().size (), " component matching index should exist" );
179
+ return operands ()[index ];
180
+ }
181
+
182
+ // / \return The expression for a named component of this struct.
183
+ const exprt &
184
+ struct_exprt::component (const irep_idt &name, const namespacet &ns) const
185
+ {
186
+ const auto index = to_struct_type (ns.follow (type ())).component_number (name);
187
+ DATA_INVARIANT (
188
+ index < operands ().size (), " component matching index should exist" );
189
+ return operands ()[index ];
190
+ }
Original file line number Diff line number Diff line change @@ -1824,23 +1824,8 @@ class struct_exprt:public exprt
1824
1824
{
1825
1825
}
1826
1826
1827
- // / \return The expression for a named component of this struct.
1828
- exprt &component (const irep_idt &name)
1829
- {
1830
- const auto index = to_struct_type (type ()).component_number (name);
1831
- DATA_INVARIANT (
1832
- index < operands ().size (), " component matching index should exist" );
1833
- return operands ()[index ];
1834
- }
1835
-
1836
- // / \return The expression for a named component of this struct.
1837
- const exprt &component (const irep_idt &name) const
1838
- {
1839
- const auto index = to_struct_type (type ()).component_number (name);
1840
- DATA_INVARIANT (
1841
- index < operands ().size (), " component matching index should exist" );
1842
- return operands ()[index ];
1843
- }
1827
+ exprt &component (const irep_idt &name, const namespacet &ns);
1828
+ const exprt &component (const irep_idt &name, const namespacet &ns) const ;
1844
1829
};
1845
1830
1846
1831
/* ! \brief Cast a generic exprt to a \ref struct_exprt
You can’t perform that action at this time.
0 commit comments