cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
goto_functions.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Goto Programs with Functions
4
5
Author: Daniel Kroening
6
7
Date: June 2003
8
9
\*******************************************************************/
10
13
14
#ifndef CPROVER_GOTO_PROGRAMS_GOTO_FUNCTIONS_H
15
#define CPROVER_GOTO_PROGRAMS_GOTO_FUNCTIONS_H
16
17
#include "
goto_function.h
"
18
19
#include <
util/cprover_prefix.h
>
20
21
#include <map>
22
24
class
goto_functionst
25
{
26
public
:
27
using
goto_functiont
=
::goto_functiont
;
28
typedef
std::map<irep_idt, goto_functiont>
function_mapt
;
29
function_mapt
function_map
;
30
31
private
:
37
unsigned
unused_location_number
;
38
39
public
:
40
goto_functionst
():
41
unused_location_number
(0)
42
{
43
}
44
45
// Copying is unavailable as base class copy is deleted
46
// MSVC is unable to automatically determine this
47
goto_functionst
(
const
goto_functionst
&)=
delete
;
48
goto_functionst
&
operator=
(
const
goto_functionst
&)=
delete
;
49
50
// Move operations need to be explicitly enabled as they are deleted with the
51
// copy operations
52
// default for move operations isn't available on Windows yet, so define
53
// explicitly (see https://msdn.microsoft.com/en-us/library/hh567368.aspx
54
// under "Defaulted and Deleted Functions")
55
56
goto_functionst
(
goto_functionst
&&other):
57
function_map
(
std
::move(other.
function_map
)),
58
unused_location_number
(other.
unused_location_number
)
59
{
60
}
61
62
goto_functionst
&
operator=
(
goto_functionst
&&other)
63
{
64
function_map
=std::move(other.function_map);
65
unused_location_number
=other.unused_location_number;
66
return
*
this
;
67
}
68
72
std::size_t
unload
(
const
irep_idt
&name)
73
{
74
return
function_map
.erase(name);
75
}
76
77
void
clear
()
78
{
79
function_map
.clear();
80
}
81
82
void
compute_location_numbers
();
83
void
compute_location_numbers
(
goto_programt
&);
84
void
compute_loop_numbers
();
85
void
compute_target_numbers
();
86
void
compute_incoming_edges
();
87
88
void
update
()
89
{
90
compute_incoming_edges
();
91
compute_target_numbers
();
92
compute_location_numbers
();
93
compute_loop_numbers
();
94
}
95
97
static
inline
irep_idt
entry_point
()
98
{
99
// do not confuse with C's "int main()"
100
return
CPROVER_PREFIX
"_start"
;
101
}
102
103
void
swap
(
goto_functionst
&other)
104
{
105
function_map
.swap(other.
function_map
);
106
}
107
108
void
copy_from
(
const
goto_functionst
&other)
109
{
110
for
(
const
auto
&fun : other.
function_map
)
111
function_map
[fun.first].copy_from(fun.second);
112
}
113
114
std::vector<function_mapt::const_iterator>
sorted
()
const
;
115
std::vector<function_mapt::iterator>
sorted
();
116
121
void
validate
(
const
namespacet
&,
validation_modet
)
const
;
122
};
123
124
#endif
// CPROVER_GOTO_PROGRAMS_GOTO_FUNCTIONS_H
goto_functionst::operator=
goto_functionst & operator=(const goto_functionst &)=delete
goto_functionst::swap
void swap(goto_functionst &other)
Definition
goto_functions.h:103
goto_functionst::function_mapt
std::map< irep_idt, goto_functiont > function_mapt
Definition
goto_functions.h:28
goto_functionst::compute_incoming_edges
void compute_incoming_edges()
Definition
goto_functions.cpp:40
goto_functionst::compute_loop_numbers
void compute_loop_numbers()
Definition
goto_functions.cpp:56
goto_functionst::unload
std::size_t unload(const irep_idt &name)
Remove the function named name from the function map, if it exists.
Definition
goto_functions.h:72
goto_functionst::unused_location_number
unsigned unused_location_number
A location number such that numbers in the interval [unused_location_number, MAX_UINT] are all unused...
Definition
goto_functions.h:37
goto_functionst::function_map
function_mapt function_map
Definition
goto_functions.h:29
goto_functionst::goto_functiont
::goto_functiont goto_functiont
Definition
goto_functions.h:27
goto_functionst::compute_location_numbers
void compute_location_numbers()
Definition
goto_functions.cpp:21
goto_functionst::operator=
goto_functionst & operator=(goto_functionst &&other)
Definition
goto_functions.h:62
goto_functionst::validate
void validate(const namespacet &, validation_modet) const
Check that the goto functions are well-formed.
Definition
goto_functions.cpp:105
goto_functionst::goto_functionst
goto_functionst()
Definition
goto_functions.h:40
goto_functionst::update
void update()
Definition
goto_functions.h:88
goto_functionst::clear
void clear()
Definition
goto_functions.h:77
goto_functionst::sorted
std::vector< function_mapt::const_iterator > sorted() const
returns a vector of the iterators in alphabetical order
Definition
goto_functions.cpp:66
goto_functionst::goto_functionst
goto_functionst(goto_functionst &&other)
Definition
goto_functions.h:56
goto_functionst::goto_functionst
goto_functionst(const goto_functionst &)=delete
goto_functionst::entry_point
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
Definition
goto_functions.h:97
goto_functionst::compute_target_numbers
void compute_target_numbers()
Definition
goto_functions.cpp:48
goto_functionst::copy_from
void copy_from(const goto_functionst &other)
Definition
goto_functions.h:108
goto_programt
A generic container class for the GOTO intermediate representation of one function.
Definition
goto_program.h:72
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition
namespace.h:91
cprover_prefix.h
CPROVER_PREFIX
#define CPROVER_PREFIX
Definition
cprover_prefix.h:14
goto_function.h
Goto Function.
std
STL namespace.
validation_modet
validation_modet
Definition
validation_mode.h:13
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
goto-programs
goto_functions.h
Generated by
1.17.0