cprover
goto_function.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: A GOTO Function
4 
5 Author: Daniel Kroening
6 
7 Date: May 2018
8 
9 \*******************************************************************/
10 
11 #ifndef CPROVER_GOTO_PROGRAMS_GOTO_FUNCTION_H
12 #define CPROVER_GOTO_PROGRAMS_GOTO_FUNCTION_H
13 
14 #include <iosfwd>
15 
16 #include <util/std_types.h>
17 
18 #include "goto_program.h"
19 
21 {
22 public:
25 
26  typedef std::vector<irep_idt> parameter_identifierst;
28 
29  bool body_available() const
30  {
31  return !body.instructions.empty();
32  }
33 
34  bool is_inlined() const
35  {
36  return type.get_bool(ID_C_inlined);
37  }
38 
39  bool is_hidden() const
40  {
41  return type.get_bool(ID_C_hide);
42  }
43 
44  void make_hidden()
45  {
46  type.set(ID_C_hide, true);
47  }
48 
50  {
51  }
52 
53  void clear()
54  {
55  body.clear();
56  type.clear();
57  parameter_identifiers.clear();
58  }
59 
63  void update_instructions_function(const irep_idt &function_id)
64  {
66  }
67 
68  void swap(goto_functiont &other)
69  {
70  body.swap(other.body);
71  type.swap(other.type);
73  }
74 
75  void copy_from(const goto_functiont &other)
76  {
77  body.copy_from(other.body);
78  type = other.type;
80  }
81 
82  goto_functiont(const goto_functiont &) = delete;
83  goto_functiont &operator=(const goto_functiont &) = delete;
84 
86  : body(std::move(other.body)),
87  type(std::move(other.type)),
89  {
90  }
91 
93  {
94  body = std::move(other.body);
95  type = std::move(other.type);
96  parameter_identifiers = std::move(other.parameter_identifiers);
97  return *this;
98  }
99 };
100 
101 void get_local_identifiers(const goto_functiont &, std::set<irep_idt> &dest);
102 
103 #endif // CPROVER_GOTO_PROGRAMS_GOTO_FUNCTION_H
Base type of functions.
Definition: std_types.h:764
void swap(goto_functiont &other)
Definition: goto_function.h:68
parameter_identifierst parameter_identifiers
Definition: goto_function.h:27
goto_programt body
Definition: goto_function.h:23
void make_hidden()
Definition: goto_function.h:44
STL namespace.
void copy_from(const goto_programt &src)
Copy a full goto program, preserving targets.
bool get_bool(const irep_namet &name) const
Definition: irep.cpp:240
std::vector< irep_idt > parameter_identifierst
Definition: goto_function.h:26
void update_instructions_function(const irep_idt &function_id)
update the function member in each instruction
Definition: goto_function.h:63
goto_functiont & operator=(const goto_functiont &)=delete
void clear()
Clear the goto program.
Definition: goto_program.h:611
goto_functiont(goto_functiont &&other)
Definition: goto_function.h:85
bool is_inlined() const
Definition: goto_function.h:34
The empty type.
Definition: std_types.h:54
instructionst instructions
The list of instructions in the goto program.
Definition: goto_program.h:403
void copy_from(const goto_functiont &other)
Definition: goto_function.h:75
code_typet type
Definition: goto_function.h:24
goto_functiont & operator=(goto_functiont &&other)
Definition: goto_function.h:92
void swap(goto_programt &program)
Swap the goto program.
Definition: goto_program.h:605
bool is_hidden() const
Definition: goto_function.h:39
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:70
API to type classes.
bool body_available() const
Definition: goto_function.h:29
void update_instructions_function(const irep_idt &function_id)
Sets the function member of each instruction if not yet set Note that a goto program need not be a go...
Definition: goto_program.h:558
void clear()
Definition: irep.h:241
void swap(irept &irep)
Definition: irep.h:231
void get_local_identifiers(const goto_functiont &, std::set< irep_idt > &dest)
Concrete Goto Program.
void set(const irep_namet &name, const irep_idt &value)
Definition: irep.h:214