11
11
12
12
#include < algorithm>
13
13
14
- #include < util/message.h>
15
14
#include < util/suffix.h>
16
15
#include < util/string2int.h>
17
16
@@ -27,7 +26,8 @@ class remove_static_init_loopst
27
26
28
27
void unwind_enum_static (
29
28
const goto_functionst &goto_functions,
30
- optionst &options);
29
+ optionst &options,
30
+ message_handlert &);
31
31
protected:
32
32
const symbol_tablet &symbol_table;
33
33
};
@@ -38,9 +38,12 @@ class remove_static_init_loopst
38
38
// / \return side effect is adding <clinit> loops to unwindset
39
39
void remove_static_init_loopst::unwind_enum_static (
40
40
const goto_functionst &goto_functions,
41
- optionst &options)
41
+ optionst &options,
42
+ message_handlert &msg)
42
43
{
43
44
size_t unwind_max=0 ;
45
+ messaget message;
46
+ message.set_message_handler (msg);
44
47
forall_goto_functions (f, goto_functions)
45
48
{
46
49
auto &p=f->second .body ;
@@ -53,6 +56,13 @@ void remove_static_init_loopst::unwind_enum_static(
53
56
const std::string java_clinit=" <clinit>:()V" ;
54
57
const std::string &fname=id2string (ins.function );
55
58
size_t class_prefix_length=fname.find_last_of (' .' );
59
+ // is the function symbol in the symbol table?
60
+ if (!symbol_table.has_symbol (ins.function ))
61
+ {
62
+ message.warning () << " function `" << id2string (ins.function )
63
+ << " ` is not in symbol table" << messaget::eom;
64
+ continue ;
65
+ }
56
66
// is Java function and static init?
57
67
const symbolt &function_name=symbol_table.lookup (ins.function );
58
68
if (!(function_name.mode ==ID_java && has_suffix (fname, java_clinit)))
@@ -96,8 +106,9 @@ void remove_static_init_loopst::unwind_enum_static(
96
106
void remove_static_init_loops (
97
107
const symbol_tablet &symbol_table,
98
108
const goto_functionst &goto_functions,
99
- optionst &options)
109
+ optionst &options,
110
+ message_handlert &msg)
100
111
{
101
112
remove_static_init_loopst remove_loops (symbol_table);
102
- remove_loops.unwind_enum_static (goto_functions, options);
113
+ remove_loops.unwind_enum_static (goto_functions, options, msg );
103
114
}
0 commit comments