cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
generate_function_bodies.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Replace bodies of goto functions
4
5
Author: Diffblue Ltd.
6
7
\*******************************************************************/
8
9
#ifndef CPROVER_GOTO_PROGRAMS_GENERATE_FUNCTION_BODIES_H
10
#define CPROVER_GOTO_PROGRAMS_GENERATE_FUNCTION_BODIES_H
11
12
#include <memory>
13
#include <regex>
14
15
#include <
util/irep.h
>
16
17
class
goto_functiont
;
18
class
goto_modelt
;
19
class
message_handlert
;
20
class
symbol_tablet
;
21
struct
c_object_factory_parameterst
;
22
24
class
generate_function_bodiest
25
{
26
protected
:
33
virtual
void
generate_function_body_impl
(
34
goto_functiont
&function,
35
symbol_tablet
&symbol_table,
36
const
irep_idt
&function_name)
const
= 0;
37
38
public
:
39
virtual
~generate_function_bodiest
() =
default
;
40
46
void
generate_function_body
(
47
goto_functiont
&function,
48
symbol_tablet
&symbol_table,
49
const
irep_idt
&function_name)
const
;
50
51
private
:
55
void
generate_parameter_names
(
56
goto_functiont
&function,
57
symbol_tablet
&symbol_table,
58
const
irep_idt
&function_name)
const
;
59
};
60
61
std::unique_ptr<generate_function_bodiest>
generate_function_bodies_factory
(
62
const
std::string &options,
63
const
c_object_factory_parameterst
&object_factory_parameters,
64
const
symbol_tablet
&symbol_table,
65
message_handlert
&message_handler);
66
67
void
generate_function_bodies
(
68
const
std::regex &functions_regex,
69
const
generate_function_bodiest
&generate_function_body,
70
goto_modelt
&model,
71
message_handlert
&message_handler,
72
bool
ignore_no_match);
73
81
void
generate_function_bodies
(
82
const
std::string &function_name,
83
const
std::string &call_site_id,
84
const
generate_function_bodiest
&generate_function_body,
85
goto_modelt
&model,
86
message_handlert
&message_handler);
87
88
#define OPT_REPLACE_FUNCTION_BODY \
89
"(generate-function-body):" \
90
"(generate-havocing-body):" \
91
"(generate-function-body-options):"
92
93
#define HELP_REPLACE_FUNCTION_BODY \
94
" {y--generate-function-body} {uregex} \t " \
95
"generate bodies for functions matching {uregex} that do not already " \
96
"have bodies\n" \
97
" {y--generate-havocing-body} <option> " \
98
"{ufun_name},{yparams}:{up1};{up2};.. \t " \
99
"generate havocing body\n" \
100
" {y--generate-havocing-body} <option> " \
101
"{ufun_name}[,{ucall-site-id},{yparams}:{up1};{up2};..]+ \t " \
102
"generate havocing body\n" \
103
" {y--generate-function-body-options} {uoption} \t " \
104
"One of {yassert-false}, {yassume-false}, {ynondet-return}, " \
105
"{yassert-false-assume-false} and " \
106
"{yhavoc}[,{yparams}:{uregex}][,{yglobals}:{uregex}]" \
107
"[,{yparams}:{up1};{up2};..] (default: {ynondet-return})\n"
108
109
#endif
// CPROVER_GOTO_PROGRAMS_GENERATE_FUNCTION_BODIES_H
generate_function_bodiest
Base class for replace_function_body implementations.
Definition
generate_function_bodies.h:25
generate_function_bodiest::generate_function_body
void generate_function_body(goto_functiont &function, symbol_tablet &symbol_table, const irep_idt &function_name) const
Replace the function body with one based on the replace_function_body class being used.
Definition
generate_function_bodies.cpp:24
generate_function_bodiest::generate_parameter_names
void generate_parameter_names(goto_functiont &function, symbol_tablet &symbol_table, const irep_idt &function_name) const
Generate parameter names for unnamed parameters.
Definition
generate_function_bodies.cpp:34
generate_function_bodiest::~generate_function_bodiest
virtual ~generate_function_bodiest()=default
generate_function_bodiest::generate_function_body_impl
virtual void generate_function_body_impl(goto_functiont &function, symbol_tablet &symbol_table, const irep_idt &function_name) const =0
Produce a body for the passed function At this point the body of function is always empty,...
goto_functiont
A goto function, consisting of function body (see body) and parameter identifiers (see parameter_iden...
Definition
goto_function.h:24
goto_modelt
Definition
goto_model.h:27
message_handlert
Definition
message.h:27
symbol_tablet
The symbol table.
Definition
symbol_table.h:14
generate_function_bodies_factory
std::unique_ptr< generate_function_bodiest > generate_function_bodies_factory(const std::string &options, const c_object_factory_parameterst &object_factory_parameters, const symbol_tablet &symbol_table, message_handlert &message_handler)
Create the type that actually generates the functions.
Definition
generate_function_bodies.cpp:375
generate_function_bodies
void generate_function_bodies(const std::regex &functions_regex, const generate_function_bodiest &generate_function_body, goto_modelt &model, message_handlert &message_handler, bool ignore_no_match)
Generate function bodies with some default behavior: assert-false, assume-false, assert-false-assume-...
Definition
generate_function_bodies.cpp:503
irep.h
c_object_factory_parameterst
Definition
c_object_factory_parameters.h:15
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
goto-instrument
generate_function_bodies.h
Generated by
1.17.0