@@ -43,11 +43,17 @@ static std::string generate_fresh_automaton_variable_for_token(
43
43
// / The function is responsible for updating structure initialiser
44
44
// / instruction of an ASSIGN instruction, i.e. the rhs of the instruction,
45
45
// / according to new (instrumented) type of the lhs of the assignement.
46
+ // / \param initialiser: The original structure initialiser whose instrumented
47
+ // / version is computed
48
+ // / \param fixed_type: Updated type of assignment's LHS which we will use as
49
+ // / a guide for instrumentation of the original initialiser.
50
+ // / \param props: Data computed in the previous step (before the instrumenter)
51
+ // / required here to know what to instrument and where.
46
52
exprt taint_instrumentert::
47
53
add_shadow_variables_to_structure_initializer (
48
- const exprt &initialiser, // /< The original structure initialiser
49
- const struct_typet &fixed_type, // /< Updated type of assignment's LHS
50
- const taint_instrumentation_propst &props /* *< doxylinter be silent */ ) const
54
+ const exprt &initialiser,
55
+ const struct_typet &fixed_type,
56
+ const taint_instrumentation_propst &props) const
51
57
{
52
58
const namespacet ns (get_instrumented_symbol_table ());
53
59
struct_exprt fixed_initialiser (fixed_type);
@@ -98,15 +104,17 @@ void taint_instrumentert::instrument_instructions_with_shadow_variables(
98
104
const taint_instrumentation_propst &props) const
99
105
{
100
106
const namespacet ns (get_instrumented_symbol_table ());
101
- for (auto &I : instructions_to_be_instrumented)
107
+ for (auto &instr : instructions_to_be_instrumented)
102
108
{
103
- switch (I .type )
109
+ switch (instr .type )
104
110
{
105
111
case ASSIGN:
106
112
{
107
- code_assignt &asgn=to_code_assign (I .code );
113
+ code_assignt &asgn=to_code_assign (instr .code );
108
114
if (asgn.rhs ().id ()==ID_struct)
109
115
{
116
+ // Here we handle assignments where RHS is a structure initialiser,
117
+ // e.g. *x={.data=null,.length=10,...}.
110
118
asgn.rhs ()=
111
119
add_shadow_variables_to_structure_initializer (
112
120
asgn.rhs (),
@@ -218,7 +226,7 @@ void taint_instrumentert::run()
218
226
std::map<
219
227
taint_instrumentation_propst::location_props_idt,
220
228
taint_mutable_instruction_idt> instrumented_locations;
221
- for (std::vector< taint_instrumentation_propst::location_propst>::size_type
229
+ for (taint_instrumentation_propst::location_props_idt
222
230
lid=0UL , end=props.get_location_props ().size ();
223
231
lid!=end;
224
232
++lid)
0 commit comments