Skip to content

Commit c091992

Browse files
committed
Avoid shadowing class member "set_of_cycles"
We pass different sets of cycles in there, only sometimes the actual class member itself.
1 parent a4c52bd commit c091992

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

src/goto-instrument/wmm/instrumenter_strategies.cpp

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,12 @@ void instrumentert::instrument_with_strategy(instrumentation_strategyt strategy)
8181
}
8282

8383
void inline instrumentert::instrument_all_inserter(
84-
const std::set<event_grapht::critical_cyclet> &set_of_cycles)
84+
const std::set<event_grapht::critical_cyclet> &subset_of_cycles)
8585
{
86-
for(std::set<event_grapht::critical_cyclet>::const_iterator
87-
it=(set_of_cycles).begin();
88-
it!=(set_of_cycles).end(); ++it)
86+
for(std::set<event_grapht::critical_cyclet>::const_iterator it =
87+
subset_of_cycles.begin();
88+
it != subset_of_cycles.end();
89+
++it)
8990
{
9091
for(std::set<event_grapht::critical_cyclet::delayt>::const_iterator
9192
p_it=it->unsafe_pairs.begin();
@@ -109,15 +110,16 @@ void inline instrumentert::instrument_all_inserter(
109110
}
110111

111112
void inline instrumentert::instrument_one_event_per_cycle_inserter(
112-
const std::set<event_grapht::critical_cyclet> &set_of_cycles)
113+
const std::set<event_grapht::critical_cyclet> &subset_of_cycles)
113114
{
114115
/* to keep track of the delayed pair, and to avoid the instrumentation
115116
of two pairs in a same cycle */
116117
std::set<event_grapht::critical_cyclet::delayt> delayed;
117118

118-
for(std::set<event_grapht::critical_cyclet>::iterator
119-
it=set_of_cycles.begin();
120-
it!=set_of_cycles.end(); ++it)
119+
for(std::set<event_grapht::critical_cyclet>::iterator it =
120+
subset_of_cycles.begin();
121+
it != subset_of_cycles.end();
122+
++it)
121123
{
122124
/* cycle with already a delayed pair? */
123125
bool next=false;
@@ -189,7 +191,7 @@ unsigned inline instrumentert::cost(
189191
}
190192

191193
void inline instrumentert::instrument_minimum_interference_inserter(
192-
const std::set<event_grapht::critical_cyclet> &set_of_cycles)
194+
const std::set<event_grapht::critical_cyclet> &subset_of_cycles)
193195
{
194196
/* Idea:
195197
We solve this by a linear programming approach,
@@ -216,10 +218,10 @@ void inline instrumentert::instrument_minimum_interference_inserter(
216218
#ifdef HAVE_GLPK
217219
/* first, identify all the unsafe pairs */
218220
std::set<event_grapht::critical_cyclet::delayt> edges;
219-
for(std::set<event_grapht::critical_cyclet>::iterator
220-
C_j=set_of_cycles.begin();
221-
C_j!=set_of_cycles.end();
222-
++C_j)
221+
for(std::set<event_grapht::critical_cyclet>::iterator C_j =
222+
subset_of_cycles.begin();
223+
C_j != subset_of_cycles.end();
224+
++C_j)
223225
for(std::set<event_grapht::critical_cyclet::delayt>::const_iterator e_i=
224226
C_j->unsafe_pairs.begin();
225227
e_i!=C_j->unsafe_pairs.end();
@@ -236,8 +238,8 @@ void inline instrumentert::instrument_minimum_interference_inserter(
236238
glp_set_prob_name(lp, "instrumentation optimisation");
237239
glp_set_obj_dir(lp, GLP_MIN);
238240

239-
message.debug() << "edges: "<<edges.size()<<" cycles:"<<set_of_cycles.size()
240-
<< messaget::eom;
241+
message.debug() << "edges: " << edges.size()
242+
<< " cycles:" << subset_of_cycles.size() << messaget::eom;
241243

242244
/* sets the variables and coefficients */
243245
glp_add_cols(lp, edges.size());
@@ -256,20 +258,20 @@ void inline instrumentert::instrument_minimum_interference_inserter(
256258
}
257259

258260
/* sets the constraints (soundness): one per cycle */
259-
glp_add_rows(lp, set_of_cycles.size());
261+
glp_add_rows(lp, subset_of_cycles.size());
260262
i=0;
261-
for(std::set<event_grapht::critical_cyclet>::iterator
262-
C_j=set_of_cycles.begin();
263-
C_j!=set_of_cycles.end();
264-
++C_j)
263+
for(std::set<event_grapht::critical_cyclet>::iterator C_j =
264+
subset_of_cycles.begin();
265+
C_j != subset_of_cycles.end();
266+
++C_j)
265267
{
266268
++i;
267269
std::string name="C_"+std::to_string(i);
268270
glp_set_row_name(lp, i, name.c_str());
269271
glp_set_row_bnds(lp, i, GLP_LO, 1.0, 0.0); /* >= 1*/
270272
}
271273

272-
const std::size_t mat_size=set_of_cycles.size()*edges.size();
274+
const std::size_t mat_size = subset_of_cycles.size() * edges.size();
273275
message.debug() << "size of the system: " << mat_size
274276
<< messaget::eom;
275277
std::vector<int> imat(mat_size+1);
@@ -287,10 +289,10 @@ void inline instrumentert::instrument_minimum_interference_inserter(
287289
++e_i)
288290
{
289291
row=1;
290-
for(std::set<event_grapht::critical_cyclet>::iterator
291-
C_j=set_of_cycles.begin();
292-
C_j!=set_of_cycles.end();
293-
++C_j)
292+
for(std::set<event_grapht::critical_cyclet>::iterator C_j =
293+
subset_of_cycles.begin();
294+
C_j != subset_of_cycles.end();
295+
++C_j)
294296
{
295297
imat[i]=row;
296298
jmat[i]=col;
@@ -344,7 +346,7 @@ void inline instrumentert::instrument_minimum_interference_inserter(
344346

345347
glp_delete_prob(lp);
346348
#else
347-
(void)set_of_cycles; // unused parameter
349+
(void)subset_of_cycles; // unused parameter
348350
throw "sorry, minimum interference option requires glpk; "
349351
"please recompile goto-instrument with glpk";
350352
#endif

0 commit comments

Comments
 (0)