Skip to content

Commit 05a8da2

Browse files
Make goto_convert_functions not add directly to function map
This won't be supported with lazy function loading as it won't use goto_functionst
1 parent c078858 commit 05a8da2

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

src/goto-cc/compile.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ void compilet::add_compiler_specific_defines(configt &config) const
691691

692692
void compilet::convert_symbols(goto_functionst &dest)
693693
{
694-
goto_convert_functionst converter(symbol_table, dest, get_message_handler());
694+
goto_convert_functionst converter(symbol_table, get_message_handler());
695695

696696
// the compilation may add symbols!
697697

@@ -724,7 +724,7 @@ void compilet::convert_symbols(goto_functionst &dest)
724724
s_it->second.value.is_not_nil())
725725
{
726726
debug() << "Compiling " << s_it->first << eom;
727-
converter.convert_function(s_it->first);
727+
converter.convert_function(s_it->first, dest.function_map[s_it->first]);
728728
symbol_table.get_writeable_ref(*it).value=exprt("compiled");
729729
}
730730
}

src/goto-programs/goto_convert_functions.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,16 @@ Date: June 2003
2121

2222
goto_convert_functionst::goto_convert_functionst(
2323
symbol_tablet &_symbol_table,
24-
goto_functionst &_functions,
2524
message_handlert &_message_handler):
26-
goto_convertt(_symbol_table, _message_handler),
27-
functions(_functions)
25+
goto_convertt(_symbol_table, _message_handler)
2826
{
2927
}
3028

3129
goto_convert_functionst::~goto_convert_functionst()
3230
{
3331
}
3432

35-
void goto_convert_functionst::goto_convert()
33+
void goto_convert_functionst::goto_convert(goto_functionst &functions)
3634
{
3735
// warning! hash-table iterators are not stable
3836

@@ -53,7 +51,7 @@ void goto_convert_functionst::goto_convert()
5351

5452
for(const auto &id : symbol_list)
5553
{
56-
convert_function(id);
54+
convert_function(id, functions.function_map[id]);
5755
}
5856

5957
functions.compute_location_numbers();
@@ -135,10 +133,11 @@ void goto_convert_functionst::add_return(
135133
t->source_location=source_location;
136134
}
137135

138-
void goto_convert_functionst::convert_function(const irep_idt &identifier)
136+
void goto_convert_functionst::convert_function(
137+
const irep_idt &identifier,
138+
goto_functionst::goto_functiont &f)
139139
{
140140
const symbolt &symbol=ns.lookup(identifier);
141-
goto_functionst::goto_functiont &f=functions.function_map[identifier];
142141

143142
if(f.body_available())
144143
return; // already converted
@@ -240,12 +239,11 @@ void goto_convert(
240239
const unsigned errors_before=
241240
message_handler.get_message_count(messaget::M_ERROR);
242241

243-
goto_convert_functionst goto_convert_functions(
244-
symbol_table, functions, message_handler);
242+
goto_convert_functionst goto_convert_functions(symbol_table, message_handler);
245243

246244
try
247245
{
248-
goto_convert_functions.goto_convert();
246+
goto_convert_functions.goto_convert(functions);
249247
}
250248

251249
catch(int)
@@ -276,12 +274,12 @@ void goto_convert(
276274
const unsigned errors_before=
277275
message_handler.get_message_count(messaget::M_ERROR);
278276

279-
goto_convert_functionst goto_convert_functions(
280-
symbol_table, functions, message_handler);
277+
goto_convert_functionst goto_convert_functions(symbol_table, message_handler);
281278

282279
try
283280
{
284-
goto_convert_functions.convert_function(identifier);
281+
goto_convert_functions.convert_function(
282+
identifier, functions.function_map[identifier]);
285283
}
286284

287285
catch(int)

src/goto-programs/goto_convert_functions.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Date: June 2003
1616

1717
#include "goto_model.h"
1818
#include "goto_convert_class.h"
19+
#include "goto_functions.h"
1920

2021
// convert it all!
2122
void goto_convert(
@@ -38,19 +39,18 @@ void goto_convert(
3839
class goto_convert_functionst:public goto_convertt
3940
{
4041
public:
41-
void goto_convert();
42-
void convert_function(const irep_idt &identifier);
42+
void goto_convert(goto_functionst &functions);
43+
void convert_function(
44+
const irep_idt &identifier,
45+
goto_functionst::goto_functiont &result);
4346

4447
goto_convert_functionst(
4548
symbol_tablet &_symbol_table,
46-
goto_functionst &_functions,
4749
message_handlert &_message_handler);
4850

4951
virtual ~goto_convert_functionst();
5052

5153
protected:
52-
goto_functionst &functions;
53-
5454
static bool hide(const goto_programt &);
5555

5656
//

0 commit comments

Comments
 (0)