Skip to content

Commit 611f8a1

Browse files
committed
Move nondet volatile functionality into class nondet_volatilet
This is in preparation of adding a new feature to selectively provide models for volatile reads. For this member variables will be added to nondet_volatilet to store configuration.
1 parent 8b604a7 commit 611f8a1

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/goto-instrument/nondet_volatile.cpp

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,29 @@ Date: September 2011
2020

2121
using havoc_predicatet = std::function<bool(const exprt &)>;
2222

23-
static bool is_volatile(const namespacet &ns, const typet &src)
23+
class nondet_volatilet
24+
{
25+
public:
26+
static void nondet_volatile(
27+
symbol_tablet &symbol_table,
28+
goto_programt &goto_program,
29+
havoc_predicatet should_havoc);
30+
31+
private:
32+
static bool is_volatile(const namespacet &ns, const typet &src);
33+
34+
static void nondet_volatile_rhs(
35+
const symbol_tablet &symbol_table,
36+
exprt &expr,
37+
havoc_predicatet should_havoc);
38+
39+
static void nondet_volatile_lhs(
40+
const symbol_tablet &symbol_table,
41+
exprt &expr,
42+
havoc_predicatet should_havoc);
43+
};
44+
45+
bool nondet_volatilet::is_volatile(const namespacet &ns, const typet &src)
2446
{
2547
if(src.get_bool(ID_C_volatile))
2648
return true;
@@ -35,7 +57,7 @@ static bool is_volatile(const namespacet &ns, const typet &src)
3557
return false;
3658
}
3759

38-
static void nondet_volatile_rhs(
60+
void nondet_volatilet::nondet_volatile_rhs(
3961
const symbol_tablet &symbol_table,
4062
exprt &expr,
4163
havoc_predicatet should_havoc)
@@ -59,7 +81,7 @@ static void nondet_volatile_rhs(
5981
}
6082
}
6183

62-
static void nondet_volatile_lhs(
84+
void nondet_volatilet::nondet_volatile_lhs(
6385
const symbol_tablet &symbol_table,
6486
exprt &expr,
6587
havoc_predicatet should_havoc)
@@ -91,7 +113,7 @@ static void nondet_volatile_lhs(
91113
}
92114
}
93115

94-
static void nondet_volatile(
116+
void nondet_volatilet::nondet_volatile(
95117
symbol_tablet &symbol_table,
96118
goto_programt &goto_program,
97119
havoc_predicatet should_havoc)
@@ -139,7 +161,8 @@ static void nondet_volatile(
139161
void nondet_volatile(goto_modelt &goto_model, havoc_predicatet should_havoc)
140162
{
141163
Forall_goto_functions(f_it, goto_model.goto_functions)
142-
nondet_volatile(goto_model.symbol_table, f_it->second.body, should_havoc);
164+
nondet_volatilet::nondet_volatile(
165+
goto_model.symbol_table, f_it->second.body, should_havoc);
143166

144167
goto_model.goto_functions.update();
145168
}

0 commit comments

Comments
 (0)