Skip to content

Commit 0d8e3c1

Browse files
committed
Constify slicing_criteriont::operator()
This enables us to use a const-ref in the reachability and full slicers.
1 parent a9363da commit 0d8e3c1

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

src/goto-instrument/full_slicer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static bool implicit(goto_programt::const_targett target)
284284
void full_slicert::operator()(
285285
goto_functionst &goto_functions,
286286
const namespacet &ns,
287-
slicing_criteriont &criterion)
287+
const slicing_criteriont &criterion)
288288
{
289289
// build the CFG data structure
290290
cfg(goto_functions);
@@ -367,7 +367,7 @@ void full_slicert::operator()(
367367
void full_slicer(
368368
goto_functionst &goto_functions,
369369
const namespacet &ns,
370-
slicing_criteriont &criterion)
370+
const slicing_criteriont &criterion)
371371
{
372372
full_slicert()(goto_functions, ns, criterion);
373373
}

src/goto-instrument/full_slicer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ class slicing_criteriont
3333
{
3434
public:
3535
virtual ~slicing_criteriont();
36-
virtual bool operator()(goto_programt::const_targett)=0;
36+
virtual bool operator()(goto_programt::const_targett) const = 0;
3737
};
3838

3939
void full_slicer(
4040
goto_functionst &goto_functions,
4141
const namespacet &ns,
42-
slicing_criteriont &criterion);
42+
const slicing_criteriont &criterion);
4343

4444
#endif // CPROVER_GOTO_INSTRUMENT_FULL_SLICER_H

src/goto-instrument/full_slicer_class.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class full_slicert
4141
void operator()(
4242
goto_functionst &goto_functions,
4343
const namespacet &ns,
44-
slicing_criteriont &criterion);
44+
const slicing_criteriont &criterion);
4545

4646
protected:
4747
struct cfg_nodet
@@ -107,7 +107,7 @@ class full_slicert
107107
class assert_criteriont:public slicing_criteriont
108108
{
109109
public:
110-
virtual bool operator()(goto_programt::const_targett target)
110+
virtual bool operator()(goto_programt::const_targett target) const
111111
{
112112
return target->is_assert();
113113
}
@@ -121,7 +121,7 @@ class in_function_criteriont : public slicing_criteriont
121121
{
122122
}
123123

124-
virtual bool operator()(goto_programt::const_targett target)
124+
virtual bool operator()(goto_programt::const_targett target) const
125125
{
126126
return target->function == target_function;
127127
}
@@ -139,7 +139,7 @@ class properties_criteriont:public slicing_criteriont
139139
{
140140
}
141141

142-
virtual bool operator()(goto_programt::const_targett target)
142+
virtual bool operator()(goto_programt::const_targett target) const
143143
{
144144
if(!target->is_assert())
145145
return false;

src/goto-instrument/reachability_slicer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Author: Daniel Kroening, [email protected]
3535
std::vector<reachability_slicert::cfgt::node_indext>
3636
reachability_slicert::get_sources(
3737
const is_threadedt &is_threaded,
38-
slicing_criteriont &criterion)
38+
const slicing_criteriont &criterion)
3939
{
4040
std::vector<cfgt::node_indext> sources;
4141
for(const auto &e_it : cfg.entry_map)
@@ -164,7 +164,7 @@ void reachability_slicert::backward_inwards_walk_from(
164164
/// \param criterion the criterion we are trying to hit
165165
void reachability_slicert::fixedpoint_to_assertions(
166166
const is_threadedt &is_threaded,
167-
slicing_criteriont &criterion)
167+
const slicing_criteriont &criterion)
168168
{
169169
std::vector<cfgt::node_indext> sources = get_sources(is_threaded, criterion);
170170

@@ -302,7 +302,7 @@ void reachability_slicert::forward_inwards_walk_from(
302302
/// \param criterion the criterion we are trying to hit
303303
void reachability_slicert::fixedpoint_from_assertions(
304304
const is_threadedt &is_threaded,
305-
slicing_criteriont &criterion)
305+
const slicing_criteriont &criterion)
306306
{
307307
std::vector<cfgt::node_indext> sources = get_sources(is_threaded, criterion);
308308

src/goto-instrument/reachability_slicer_class.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class reachability_slicert
2424
public:
2525
void operator()(
2626
goto_functionst &goto_functions,
27-
slicing_criteriont &criterion,
27+
const slicing_criteriont &criterion,
2828
bool include_forward_reachability)
2929
{
3030
cfg(goto_functions);
@@ -76,11 +76,11 @@ class reachability_slicert
7676

7777
void fixedpoint_to_assertions(
7878
const is_threadedt &is_threaded,
79-
slicing_criteriont &criterion);
79+
const slicing_criteriont &criterion);
8080

8181
void fixedpoint_from_assertions(
8282
const is_threadedt &is_threaded,
83-
slicing_criteriont &criterion);
83+
const slicing_criteriont &criterion);
8484

8585
void slice(goto_functionst &goto_functions);
8686

@@ -100,8 +100,9 @@ class reachability_slicert
100100
std::vector<cfgt::node_indext> &callsite_successor_stack,
101101
std::vector<cfgt::node_indext> &callee_head_stack);
102102

103-
std::vector<cfgt::node_indext>
104-
get_sources(const is_threadedt &is_threaded, slicing_criteriont &criterion);
103+
std::vector<cfgt::node_indext> get_sources(
104+
const is_threadedt &is_threaded,
105+
const slicing_criteriont &criterion);
105106
};
106107

107108
#endif // CPROVER_GOTO_INSTRUMENT_REACHABILITY_SLICER_CLASS_H

0 commit comments

Comments
 (0)