CBMC
generate_function_bodies.h File Reference
#include <memory>
#include <regex>
#include <util/irep.h>
+ Include dependency graph for generate_function_bodies.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  generate_function_bodiest
 Base class for replace_function_body implementations. More...
 

Macros

#define OPT_REPLACE_FUNCTION_BODY
 
#define HELP_REPLACE_FUNCTION_BODY
 

Functions

std::unique_ptr< generate_function_bodiestgenerate_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. More...
 
void generate_function_bodies (const std::regex &functions_regex, const generate_function_bodiest &generate_function_body, goto_modelt &model, message_handlert &message_handler)
 Generate function bodies with some default behavior: assert-false, assume-false, assert-false-assume-false, havoc, nondet-return. More...
 
void generate_function_bodies (const std::string &function_name, const std::string &call_site_id, const generate_function_bodiest &generate_function_body, goto_modelt &model, message_handlert &message_handler)
 Generate a clone of function_name (labelled with call_site_id) and instantiate its body with selective havocing of its parameters. More...
 

Macro Definition Documentation

◆ HELP_REPLACE_FUNCTION_BODY

#define HELP_REPLACE_FUNCTION_BODY
Value:
" --generate-function-body <regex>\n" \
/* NOLINTNEXTLINE(whitespace/line_length) */ \
" Generate bodies for functions matching regex\n" \
" --generate-havocing-body <option>\n" \
/* NOLINTNEXTLINE(whitespace/line_length) */ \
" <fun_name>,params:<p_n1;p_n2;..>\n" \
" or\n" \
/* NOLINTNEXTLINE(whitespace/line_length) */ \
" <fun_name>[,<call-site-id>,params:<p_n1;p_n2;..>]+\n" \
" --generate-function-body-options <option>\n" \
" One of assert-false, assume-false,\n" \
/* NOLINTNEXTLINE(whitespace/line_length) */ \
" nondet-return, assert-false-assume-false and\n" \
" havoc[,params:<regex>][,globals:<regex>]\n" \
" [,params:<p_n1;p_n2;..>]\n" \
" (default: nondet-return)\n"

Definition at line 93 of file generate_function_bodies.h.

◆ OPT_REPLACE_FUNCTION_BODY

#define OPT_REPLACE_FUNCTION_BODY
Value:
"(generate-function-body):" \
"(generate-havocing-body):" \
"(generate-function-body-options):"

Definition at line 88 of file generate_function_bodies.h.

Function Documentation

◆ generate_function_bodies() [1/2]

void generate_function_bodies ( const std::regex &  functions_regex,
const generate_function_bodiest generate_function_body,
goto_modelt model,
message_handlert message_handler 
)

Generate function bodies with some default behavior: assert-false, assume-false, assert-false-assume-false, havoc, nondet-return.

Parameters
functions_regexSpecifies the functions whose body should be generated
generate_function_bodySpecifies what kind of body to generate
modelThe goto-model in which to generate the function bodies
message_handlerDestination for status/warning messages

Definition at line 511 of file generate_function_bodies.cpp.

◆ generate_function_bodies() [2/2]

void generate_function_bodies ( const std::string &  function_name,
const std::string &  call_site_id,
const generate_function_bodiest generate_function_body,
goto_modelt model,
message_handlert message_handler 
)

Generate a clone of function_name (labelled with call_site_id) and instantiate its body with selective havocing of its parameters.

Parameters
function_nameThe function whose body should be generated
call_site_idthe number of the call site
generate_function_bodythe previously constructed body generator
modelthe goto-model to be modified
message_handlerthe message-handler

Definition at line 547 of file generate_function_bodies.cpp.

◆ 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.

See also
generate_function_bodies for the syntax of the options parameter

Definition at line 385 of file generate_function_bodies.cpp.