Skip to content

Commit c5c1b64

Browse files
committed
Cleanup: split taint_instrumentert constructor
The constructor now simply sets fields, and run() does the real work.
1 parent c5e18bd commit c5c1b64

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

src/taint-slicer/instrumenter.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,26 @@ static irept add_shadow_variables_to_type(
7474
}
7575

7676
taint_instrumentert::taint_instrumentert(
77-
const taint_instrumentation_propst &props,
77+
const taint_instrumentation_propst &in_props,
7878
const taint_programt *const in_program,
7979
taint_statisticst *const in_statistics,
8080
const bool use_data_flow_insensitive_instrumentation)
81-
: program(in_program)
81+
: props(in_props)
82+
, program(in_program)
8283
, statistics(in_statistics)
8384
, use_data_flow_insensitive_version(use_data_flow_insensitive_instrumentation)
8485
{
85-
// The next line must be here in order to prevent clang produce the error:
86-
// `error: private field 'use_data_flow_insensitive_version' is not used
87-
// [-Werror,-Wunused-private-field]`
88-
(void)use_data_flow_insensitive_version;
86+
}
8987

88+
/// Builds a new symbol table from the original symbol
89+
/// table in in_program->get_symbol_table(), by removing of symbols not related
90+
/// to the set of functions defined in the passed instrumentation properties.
91+
/// The function also build a new set of functions from those defined in
92+
/// in_program->get_functions() and which appear in props.get_location_props().
93+
/// These functions are instrumented by a new code accodring to recipes in
94+
/// individual elements of props.get_location_props().
95+
void taint_instrumentert::run()
96+
{
9097
assert(program!=nullptr);
9198
assert(statistics!=nullptr);
9299

src/taint-slicer/instrumenter.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,7 @@ class taint_instrumentert
4040
4141
Outputs:
4242
43-
Purpose: The function builds a new symbol table from the original symbol
44-
table in in_program->get_symbol_table(), by removing of symbols not related
45-
to the set of functions defined in the passed instrumentation properties.
46-
The function also build a new set of functions from those defined in
47-
in_program->get_functions() and which appear in props.get_location_props().
48-
These functions are instrumented by a new code accodring to recipes in
49-
individual elements of props.get_location_props().
43+
Purpose:
5044
5145
\*******************************************************************/
5246
taint_instrumentert(
@@ -55,6 +49,8 @@ class taint_instrumentert
5549
taint_statisticst * const in_statistics,
5650
const bool use_data_flow_insensitive_instrumentation);
5751

52+
void run();
53+
5854
const goto_functionst &get_instrumented_functions() const
5955
{ return instrumented_functions; }
6056

@@ -89,6 +85,7 @@ class taint_instrumentert
8985
const std::size_t instruction_index,
9086
const taint_instrumentation_propst &props);
9187

88+
const taint_instrumentation_propst &props;
9289
const taint_programt *program;
9390
taint_statisticst *statistics;
9491
goto_functionst instrumented_functions;

src/taint-slicer/slicer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,14 @@ void taint_slicert::compute_slice(
9797
std::vector<taint_slicing_taskt> sliced_goto_programs;
9898
for(std::size_t i=0UL, n=instrumentation_props.size(); i!=n; ++i)
9999
{
100-
const taint_instrumentert instrumenter(
100+
taint_instrumentert instrumenter(
101101
instrumentation_props.at(i),
102102
program,
103103
statistics,
104104
use_data_flow_insensitive_instrumentation);
105+
106+
instrumenter.run();
107+
105108
const std::pair<taint_slicing_taskt,std::string> task_valid=
106109
build_slicing_task(
107110
instrumentation_props.at(i),

0 commit comments

Comments
 (0)