Go to the documentation of this file.
14 #ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_CONTRACTS_H
15 #define CPROVER_GOTO_INSTRUMENT_CONTRACTS_CONTRACTS_H
34 #include <unordered_set>
36 #define FLAG_LOOP_CONTRACTS "apply-loop-contracts"
37 #define HELP_LOOP_CONTRACTS \
38 " --apply-loop-contracts\n" \
39 " check and use loop contracts when provided\n"
41 #define FLAG_REPLACE_CALL "replace-call-with-contract"
42 #define HELP_REPLACE_CALL \
43 " --replace-call-with-contract <fun>\n" \
44 " replace calls to fun with fun's contract\n"
46 #define FLAG_ENFORCE_CONTRACT "enforce-contract"
47 #define HELP_ENFORCE_CONTRACT \
48 " --enforce-contract <fun> wrap fun with an assertion of its contract\n"
107 const std::set<std::string> &to_enforce,
108 const std::set<std::string> &to_exclude_from_nondet_init = {});
114 const std::set<std::string> &to_exclude_from_nondet_init = {});
123 exprt assigns_clause,
125 exprt decreases_clause,
209 std::map<exprt, exprt> ¶meter2history,
224 #endif // CPROVER_GOTO_INSTRUMENT_CONTRACTS_CONTRACTS_H
Class that provides messages with a built-in verbosity 'level'.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
void check_apply_loop_contracts(const irep_idt &function_name, goto_functionst::goto_functiont &goto_function, const local_may_aliast &local_may_alias, goto_programt::targett loop_head, goto_programt::targett loop_end, const loopt &loop, exprt assigns_clause, exprt invariant, exprt decreases_clause, const irep_idt &mode)
void enforce_contract(const irep_idt &function)
Enforce contract of a single function.
void check_frame_conditions_function(const irep_idt &function)
Instrument functions to check frame conditions.
Stores information about a goto function computed from its CFG.
void apply_loop_contracts(const std::set< std::string > &to_exclude_from_nondet_init={})
Applies loop contract transformations.
void add_contract_check(const irep_idt &wrapper_function, const irep_idt &mangled_function, goto_programt &dest)
Instruments wrapper_function adding assumptions based on requires clauses and assertions based on ens...
void replace_calls(const std::set< std::string > &to_replace)
Replace all calls to each function in the to_replace set with that function's contract.
Base class for all expressions.
void assert_function_pointer_obeys_contract(const function_pointer_obeys_contract_exprt &expr, const irep_idt &property_class, const irep_idt &mode, goto_programt &dest)
Translates a function_pointer_obeys_contract_exprt into an assertion.
A class that generates instrumentation for assigns clause checking.
void apply_function_contract(const irep_idt &function, const source_locationt &location, goto_programt &function_body, goto_programt::targett &target)
Replaces function calls with assertions based on requires clauses, non-deterministic assignments for ...
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
code_contractst(goto_modelt &goto_model, messaget &log)
void add_quantified_variable(exprt &expression, const irep_idt &mode)
This function recursively searches expression to find nested or non-nested quantified expressions.
void assume_function_pointer_obeys_contract(const function_pointer_obeys_contract_exprt &expr, const irep_idt &mode, goto_programt &dest)
Translates a function_pointer_obeys_contract_exprt into an assignment.
A loop, specified as a set of instructions.
void apply_loop_contract(const irep_idt &function, goto_functionst::goto_functiont &goto_function)
Apply loop contracts, whenever available, to all loops in function.
A class for expressions representing a requires_contract(fptr, contract) clause or an ensures_contrac...
::goto_functiont goto_functiont
void check_all_functions_found(const std::set< std::string > &functions) const
Throws an exception if some function functions is found in the program.
A collection of goto functions.
std::pair< goto_programt, goto_programt > create_ensures_instruction(codet &expression, source_locationt location, const irep_idt &mode)
This function creates and returns an instruction that corresponds to the ensures clause.
goto_functionst & goto_functions
symbol_tablet & get_symbol_table()
A generic container class for the GOTO intermediate representation of one function.
std::unordered_set< irep_idt > summarized
void replace_history_parameter(exprt &expr, std::map< exprt, exprt > ¶meter2history, source_locationt location, const irep_idt &mode, goto_programt &history, const irep_idt &id)
This function recursively identifies the "old" expressions within expr and replaces them with corresp...
void enforce_contracts(const std::set< std::string > &to_enforce, const std::set< std::string > &to_exclude_from_nondet_init={})
Turn requires & ensures into assumptions and assertions for each of the named functions.
goto_functionst & get_goto_functions()
instructionst::iterator targett
symbol_tablet & symbol_table
Data structure for representing an arbitrary statement in a program.