13
13
#include < util/config.h>
14
14
#include < util/message.h>
15
15
#include < util/pointer_expr.h>
16
- #include < util/range.h>
17
16
#include < util/symbol_table_base.h>
18
17
19
18
#include < goto-programs/goto_functions.h>
@@ -118,20 +117,14 @@ bool ansi_c_entry_point(
118
117
// find main symbol, if any is given
119
118
if (config.main .has_value ())
120
119
{
121
- std::list<irep_idt> matches;
120
+ auto matches = symbol_table. match_name_or_base_name (*config. main ) ;
122
121
123
- for (const auto &symbol_name_entry :
124
- equal_range (symbol_table.symbol_base_map , config.main .value ()))
122
+ for (auto it = matches.begin (); it != matches.end ();) // no ++it
125
123
{
126
- // look it up
127
- symbol_table_baset::symbolst::const_iterator s_it =
128
- symbol_table.symbols .find (symbol_name_entry.second );
129
-
130
- if (s_it==symbol_table.symbols .end ())
131
- continue ;
132
-
133
- if (s_it->second .type .id () == ID_code && !s_it->second .is_property )
134
- matches.push_back (symbol_name_entry.second );
124
+ if ((*it)->second .type .id () != ID_code || (*it)->second .is_property )
125
+ it = matches.erase (it);
126
+ else
127
+ ++it;
135
128
}
136
129
137
130
if (matches.empty ())
@@ -150,7 +143,7 @@ bool ansi_c_entry_point(
150
143
return true ;
151
144
}
152
145
153
- main_symbol= matches.front ();
146
+ main_symbol = matches.front ()-> first ;
154
147
}
155
148
else
156
149
main_symbol=ID_main;
0 commit comments