File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1823,6 +1823,24 @@ class struct_exprt:public exprt
1823
1823
exprt(ID_struct, _type)
1824
1824
{
1825
1825
}
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
+ }
1826
1844
};
1827
1845
1828
1846
/* ! \brief Cast a generic exprt to a \ref struct_exprt
You can’t perform that action at this time.
0 commit comments