Skip to content

Commit 2536788

Browse files
committed
Move c_new_tmp_symbol into symbol_factoryt
1 parent 3fd362d commit 2536788

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

src/ansi-c/c_nondet_symbol_factory.cpp

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,6 @@ Author: Diffblue Ltd.
2222

2323
#include <goto-programs/goto_functions.h>
2424

25-
/// Create a new temporary static symbol
26-
/// \param symbol_table: The symbol table to create the symbol in
27-
/// \param loc: The location to assign to the symbol
28-
/// \param type: The type of symbol to create
29-
/// \param static_lifetime: Whether the symbol should have a static lifetime
30-
/// \param prefix: The prefix to use for the symbol's basename
31-
/// \return Returns a reference to the new symbol
32-
static const symbolt &c_new_tmp_symbol(
33-
symbol_tablet &symbol_table,
34-
const source_locationt &loc,
35-
const typet &type,
36-
const bool static_lifetime,
37-
const std::string &prefix="tmp")
38-
{
39-
symbolt &tmp_symbol = get_fresh_aux_symbol(
40-
type, id2string(loc.get_function()), prefix, loc, ID_C, symbol_table);
41-
tmp_symbol.is_static_lifetime=static_lifetime;
42-
43-
return tmp_symbol;
44-
}
45-
4625
class symbol_factoryt
4726
{
4827
std::vector<const symbolt *> &symbols_created;
@@ -51,6 +30,13 @@ class symbol_factoryt
5130
const bool assume_non_null;
5231
namespacet ns;
5332

33+
const symbolt &c_new_tmp_symbol(
34+
//symbol_tablet &symbol_table,
35+
//const source_locationt &loc,
36+
const typet &type,
37+
const bool static_lifetime,
38+
const std::string &prefix = "tmp");
39+
5440
public:
5541
symbol_factoryt(
5642
std::vector<const symbolt *> &_symbols_created,
@@ -73,6 +59,27 @@ class symbol_factoryt
7359
void gen_nondet_init(code_blockt &assignments, const exprt &expr);
7460
};
7561

62+
/// Create a new temporary static symbol
63+
/// \param symbol_table: The symbol table to create the symbol in
64+
/// \param loc: The location to assign to the symbol
65+
/// \param type: The type of symbol to create
66+
/// \param static_lifetime: Whether the symbol should have a static lifetime
67+
/// \param prefix: The prefix to use for the symbol's basename
68+
/// \return Returns a reference to the new symbol
69+
const symbolt &symbol_factoryt::c_new_tmp_symbol(
70+
//symbol_tablet &symbol_table,
71+
//const source_locationt &loc,
72+
const typet &type,
73+
const bool static_lifetime,
74+
const std::string &prefix)
75+
{
76+
symbolt &tmp_symbol = get_fresh_aux_symbol(
77+
type, id2string(loc.get_function()), prefix, loc, ID_C, symbol_table);
78+
tmp_symbol.is_static_lifetime = static_lifetime;
79+
80+
return tmp_symbol;
81+
}
82+
7683
/// Create a symbol for a pointer to point to
7784
/// \param assignments: The code block to add code to
7885
/// \param target_expr: The expression which we are allocating a symbol for
@@ -89,8 +96,6 @@ exprt symbol_factoryt::allocate_object(
8996
{
9097
const symbolt &aux_symbol=
9198
c_new_tmp_symbol(
92-
symbol_table,
93-
loc,
9499
allocate_type,
95100
static_lifetime);
96101
symbols_created.push_back(&aux_symbol);

0 commit comments

Comments
 (0)