Skip to content

Commit b8c86e7

Browse files
author
Daniel Kroening
committed
remove_asm now guarantees that functions called exist
1 parent 0618f7d commit b8c86e7

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

src/goto-programs/remove_asm.cpp

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,24 @@ Date: December 2014
2525
class remove_asmt
2626
{
2727
public:
28-
explicit remove_asmt(symbol_tablet &_symbol_table)
29-
: symbol_table(_symbol_table)
28+
remove_asmt(
29+
symbol_tablet &_symbol_table,
30+
goto_functionst &_goto_functions)
31+
: symbol_table(_symbol_table), goto_functions(_goto_functions)
3032
{
3133
}
3234

33-
void process_function(goto_functionst::goto_functiont &);
35+
void operator()()
36+
{
37+
for(auto &f : goto_functions.function_map)
38+
process_function(f.second);
39+
}
3440

3541
protected:
3642
symbol_tablet &symbol_table;
43+
goto_functionst &goto_functions;
44+
45+
void process_function(goto_functionst::goto_functiont &);
3746

3847
void process_instruction(
3948
goto_programt::instructiont &instruction,
@@ -101,6 +110,13 @@ void remove_asmt::gcc_asm_function_call(
101110

102111
symbol_table.add(symbol);
103112
}
113+
114+
if(goto_functions.function_map.find(function_identifier)==
115+
goto_functions.function_map.end())
116+
{
117+
auto &f = goto_functions.function_map[function_identifier];
118+
f.type=fkt_type;
119+
}
104120
}
105121

106122
/// removes assembler
@@ -304,19 +320,11 @@ void remove_asmt::process_function(
304320

305321
/// removes assembler
306322
void remove_asm(
307-
goto_functionst::goto_functiont &goto_function,
323+
goto_functionst &goto_functions,
308324
symbol_tablet &symbol_table)
309325
{
310-
remove_asmt rem(symbol_table);
311-
rem.process_function(goto_function);
312-
}
313-
314-
/// removes assembler
315-
void remove_asm(goto_functionst &goto_functions, symbol_tablet &symbol_table)
316-
{
317-
remove_asmt rem(symbol_table);
318-
for(auto &f : goto_functions.function_map)
319-
rem.process_function(f.second);
326+
remove_asmt rem(symbol_table, goto_functions);
327+
rem();
320328
}
321329

322330
/// removes assembler

src/goto-programs/remove_asm.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@ Date: December 2014
2020
class goto_modelt;
2121
class symbol_tablet;
2222

23-
void remove_asm(
24-
goto_functionst::goto_functiont &goto_function,
25-
symbol_tablet &symbol_table);
23+
void remove_asm(goto_functionst &, symbol_tablet &);
2624

27-
void remove_asm(goto_functionst &goto_functions, symbol_tablet &symbol_table);
28-
29-
void remove_asm(goto_modelt &goto_model);
25+
void remove_asm(goto_modelt &);
3026

3127
#endif // CPROVER_GOTO_PROGRAMS_REMOVE_ASM_H

0 commit comments

Comments
 (0)