cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
contracts_wrangler.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Parse and annotate contracts from configuration files
4
5
Author: Qinheping Hu
6
7
Date: June 2023
8
9
\*******************************************************************/
10
13
14
#ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_CONTRACTS_WRANGLER_H
15
#define CPROVER_GOTO_INSTRUMENT_CONTRACTS_CONTRACTS_WRANGLER_H
16
17
#include <
util/message.h
>
18
#include <
util/namespace.h
>
19
#include <
util/replace_symbol.h
>
20
#include <
util/string_utils.h
>
21
22
#include <
goto-programs/goto_functions.h
>
23
#include <
goto-programs/goto_model.h
>
24
25
#include <
json/json_parser.h
>
26
27
#include <regex>
28
29
struct
loop_contracts_clauset
30
{
31
std::string
identifier
;
32
std::string
invariants
;
33
std::string
assigns
;
34
std::string
decreases
;
35
unchecked_replace_symbolt
replace_symbol
;
36
37
loop_contracts_clauset
(
38
std::string _identifier,
39
std::string _invariants_str,
40
std::string _assigns_str,
41
std::string _decreases_str,
42
unchecked_replace_symbolt
_replace_symbol)
43
:
identifier
(
std
::move(_identifier)),
44
invariants
(
std
::move(_invariants_str)),
45
assigns
(_assigns_str),
46
decreases
(_decreases_str),
47
replace_symbol
(_replace_symbol)
48
{
49
}
50
};
51
52
struct
functiont
53
{
54
std::vector<loop_contracts_clauset>
loop_contracts
;
55
std::string
regex_str
;
56
};
57
58
using
functionst
= std::list<std::pair<std::regex, functiont>>;
59
60
class
contracts_wranglert
61
{
62
public
:
63
contracts_wranglert
(
64
goto_modelt
&
goto_model
,
65
const
std::string &file_name,
66
message_handlert
&
message_handler
);
67
68
namespacet
ns
;
69
70
protected
:
71
goto_modelt
&
goto_model
;
72
symbol_tablet
&
symbol_table
;
73
goto_functionst
&
goto_functions
;
74
75
message_handlert
&
message_handler
;
76
77
functionst
functions
;
78
79
void
configure_functions
(
const
jsont
&);
80
84
void
mangle
(
85
const
loop_contracts_clauset
&loop_contracts,
86
const
irep_idt
&function_id);
87
91
void
add_builtin_pointer_function_symbol
(
92
std::string function_name,
93
const
std::size_t num_of_args);
94
};
95
96
#endif
// CPROVER_GOTO_INSTRUMENT_CONTRACTS_CONTRACTS_WRANGLER_H
contracts_wranglert::goto_model
goto_modelt & goto_model
Definition
contracts_wrangler.h:71
contracts_wranglert::symbol_table
symbol_tablet & symbol_table
Definition
contracts_wrangler.h:72
contracts_wranglert::functions
functionst functions
Definition
contracts_wrangler.h:77
contracts_wranglert::message_handler
message_handlert & message_handler
Definition
contracts_wrangler.h:75
contracts_wranglert::goto_functions
goto_functionst & goto_functions
Definition
contracts_wrangler.h:73
contracts_wranglert::configure_functions
void configure_functions(const jsont &)
Definition
contracts_wrangler.cpp:273
contracts_wranglert::add_builtin_pointer_function_symbol
void add_builtin_pointer_function_symbol(std::string function_name, const std::size_t num_of_args)
Add builtin function symbol with function_name into symbol table.
Definition
contracts_wrangler.cpp:80
contracts_wranglert::ns
namespacet ns
Definition
contracts_wrangler.h:68
contracts_wranglert::contracts_wranglert
contracts_wranglert(goto_modelt &goto_model, const std::string &file_name, message_handlert &message_handler)
Definition
contracts_wrangler.cpp:29
contracts_wranglert::mangle
void mangle(const loop_contracts_clauset &loop_contracts, const irep_idt &function_id)
Mangle loop_contracts in the function with function_id.
Definition
contracts_wrangler.cpp:100
functionst
Definition
functions.h:23
goto_functionst
A collection of goto functions.
Definition
goto_functions.h:25
goto_modelt
Definition
goto_model.h:27
jsont
Definition
json.h:27
message_handlert
Definition
message.h:27
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition
namespace.h:91
symbol_tablet
The symbol table.
Definition
symbol_table.h:14
unchecked_replace_symbolt
Definition
replace_symbol.h:103
functionst
std::list< std::pair< std::regex, functiont > > functionst
Definition
contracts_wrangler.h:58
goto_functions.h
Goto Programs with Functions.
goto_model.h
Symbol Table + CFG.
json_parser.h
namespace.h
std
STL namespace.
replace_symbol.h
message.h
string_utils.h
functiont
Definition
contracts_wrangler.h:53
functiont::regex_str
std::string regex_str
Definition
contracts_wrangler.h:55
functiont::loop_contracts
std::vector< loop_contracts_clauset > loop_contracts
Definition
contracts_wrangler.h:54
loop_contracts_clauset
Definition
contracts_wrangler.h:30
loop_contracts_clauset::loop_contracts_clauset
loop_contracts_clauset(std::string _identifier, std::string _invariants_str, std::string _assigns_str, std::string _decreases_str, unchecked_replace_symbolt _replace_symbol)
Definition
contracts_wrangler.h:37
loop_contracts_clauset::replace_symbol
unchecked_replace_symbolt replace_symbol
Definition
contracts_wrangler.h:35
loop_contracts_clauset::identifier
std::string identifier
Definition
contracts_wrangler.h:31
loop_contracts_clauset::invariants
std::string invariants
Definition
contracts_wrangler.h:32
loop_contracts_clauset::assigns
std::string assigns
Definition
contracts_wrangler.h:33
loop_contracts_clauset::decreases
std::string decreases
Definition
contracts_wrangler.h:34
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
goto-instrument
contracts
contracts_wrangler.h
Generated by
1.17.0