Skip to content

Commit c471312

Browse files
author
Remi Delmas
committed
CONTRACTS: move cleanert to the top, format imports
1 parent a118518 commit c471312

File tree

1 file changed

+34
-9
lines changed
  • src/goto-instrument/contracts

1 file changed

+34
-9
lines changed

src/goto-instrument/contracts/utils.h

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,46 @@ Date: September 2021
1111
#ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_UTILS_H
1212
#define CPROVER_GOTO_INSTRUMENT_CONTRACTS_UTILS_H
1313

14-
// clang-format off
15-
#include <vector>
14+
#include <goto-programs/goto_convert_class.h>
15+
16+
#include <util/byte_operators.h>
17+
#include <util/expr_cast.h>
18+
#include <util/message.h>
19+
20+
#include <goto-programs/goto_model.h>
1621

1722
#include <analyses/dirty.h>
1823
#include <analyses/locals.h>
19-
2024
#include <goto-instrument/havoc_utils.h>
2125

22-
#include <goto-programs/goto_convert_class.h>
23-
#include <goto-programs/goto_model.h>
26+
#include <vector>
2427

25-
#include <util/expr_cast.h>
26-
#include <util/byte_operators.h>
27-
#include <util/message.h>
28-
// clang-format on
28+
/// Class that allows to clean expressions of side effects and to generate
29+
/// havoc_slice expressions.
30+
class cleanert : public goto_convertt
31+
{
32+
public:
33+
cleanert(
34+
symbol_table_baset &_symbol_table,
35+
message_handlert &_message_handler)
36+
: goto_convertt(_symbol_table, _message_handler)
37+
{
38+
}
39+
40+
void clean(exprt &guard, goto_programt &dest, const irep_idt &mode)
41+
{
42+
goto_convertt::clean_expr(guard, dest, mode, true);
43+
}
44+
45+
void do_havoc_slice(
46+
const symbol_exprt &function,
47+
const exprt::operandst &arguments,
48+
goto_programt &dest,
49+
const irep_idt &mode)
50+
{
51+
goto_convertt::do_havoc_slice(nil_exprt{}, function, arguments, dest, mode);
52+
}
53+
};
2954

3055
/// \brief A class that overrides the low-level havocing functions in the base
3156
/// utility class, to havoc only when expressions point to valid memory,

0 commit comments

Comments
 (0)