Skip to content

Commit 0ee4e2d

Browse files
committed
Updates requested in the review.
1 parent 3745f6f commit 0ee4e2d

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/taint-slicer/instrumenter.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@ static std::string generate_fresh_automaton_variable_for_token(
4343
/// The function is responsible for updating structure initialiser
4444
/// instruction of an ASSIGN instruction, i.e. the rhs of the instruction,
4545
/// 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.
4652
exprt taint_instrumentert::
4753
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
5157
{
5258
const namespacet ns(get_instrumented_symbol_table());
5359
struct_exprt fixed_initialiser(fixed_type);
@@ -98,15 +104,17 @@ void taint_instrumentert::instrument_instructions_with_shadow_variables(
98104
const taint_instrumentation_propst &props) const
99105
{
100106
const namespacet ns(get_instrumented_symbol_table());
101-
for(auto &I : instructions_to_be_instrumented)
107+
for(auto &instr : instructions_to_be_instrumented)
102108
{
103-
switch(I.type)
109+
switch(instr.type)
104110
{
105111
case ASSIGN:
106112
{
107-
code_assignt &asgn=to_code_assign(I.code);
113+
code_assignt &asgn=to_code_assign(instr.code);
108114
if(asgn.rhs().id()==ID_struct)
109115
{
116+
// Here we handle assignments where RHS is a structure initialiser,
117+
// e.g. *x={.data=null,.length=10,...}.
110118
asgn.rhs()=
111119
add_shadow_variables_to_structure_initializer(
112120
asgn.rhs(),
@@ -218,7 +226,7 @@ void taint_instrumentert::run()
218226
std::map<
219227
taint_instrumentation_propst::location_props_idt,
220228
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
222230
lid=0UL, end=props.get_location_props().size();
223231
lid!=end;
224232
++lid)

0 commit comments

Comments
 (0)