Skip to content

Commit f7d2983

Browse files
authored
Merge pull request #3218 from smowton/smowton/fix/reachability-slicer-take-3
Reachability slicer: split cfg walks into two phases
2 parents af06d4e + 0d8e3c1 commit f7d2983

File tree

9 files changed

+280
-74
lines changed

9 files changed

+280
-74
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
void b();
2+
3+
void c()
4+
{
5+
__CPROVER_assert(0, "");
6+
b();
7+
}
8+
9+
void b()
10+
{
11+
a();
12+
c();
13+
}
14+
15+
void a()
16+
{
17+
c();
18+
}
19+
20+
int main()
21+
{
22+
a();
23+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--reachability-slice --show-goto-functions
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
main\(\)
7+
--
8+
^warning: ignoring
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
void intermediate();
2+
void root();
3+
4+
int main()
5+
{
6+
intermediate();
7+
return 1;
8+
}
9+
10+
void intermediate()
11+
{
12+
root();
13+
}
14+
15+
void root()
16+
{
17+
__CPROVER_assert(0, "");
18+
intermediate();
19+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--reachability-slice-fb --show-goto-functions
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
main#return_value = 1;
7+
--
8+
^warning: ignoring

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;

0 commit comments

Comments
 (0)