Skip to content

Commit eba46c6

Browse files
author
Daniel Kroening
committed
symbol_table API
1 parent 160ea94 commit eba46c6

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/smvlang/smv_typecheck.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ void smv_typecheckt::instantiate(
319319

320320
std::set<irep_idt> var_identifiers;
321321

322-
forall_symbol_module_map(v_it, symbol_table.symbol_module_map, identifier)
322+
for(auto v_it=symbol_table.symbol_module_map.lower_bound(identifier);
323+
v_it!=symbol_table.symbol_module_map.upper_bound(identifier);
324+
v_it++)
323325
{
324326
symbol_tablet::symbolst::const_iterator s_it2=
325327
symbol_table.symbols.find(v_it->second);
@@ -360,16 +362,16 @@ void smv_typecheckt::instantiate(
360362
v_it!=var_identifiers.end();
361363
v_it++)
362364
{
363-
symbol_tablet::symbolst::iterator s_it2=
364-
symbol_table.symbols.find(*v_it);
365+
auto s_it2=
366+
symbol_table.get_writeable(*v_it);
365367

366-
if(s_it2==symbol_table.symbols.end())
368+
if(s_it2==nullptr)
367369
{
368370
error() << "symbol `" << *v_it << "' not found" << eom;
369371
throw 0;
370372
}
371373

372-
symbolt &symbol=s_it2->second;
374+
symbolt &symbol=*s_it2;
373375

374376
if(!symbol.value.is_nil())
375377
{
@@ -632,16 +634,16 @@ void smv_typecheckt::typecheck(
632634
if(define_map.find(identifier)!=define_map.end())
633635
convert_define(identifier);
634636

635-
symbol_tablet::symbolst::iterator s_it=symbol_table.symbols.find(identifier);
637+
auto s_it=symbol_table.get_writeable(identifier);
636638

637-
if(s_it==symbol_table.symbols.end())
639+
if(s_it==nullptr)
638640
{
639641
error().source_location=expr.find_source_location();
640642
error() << "variable `" << identifier << "' not found" << eom;
641643
throw 0;
642644
}
643645

644-
symbolt &symbol=s_it->second;
646+
symbolt &symbol=*s_it;
645647

646648
assert(symbol.type.is_not_nil());
647649
expr.type()=symbol.type;
@@ -1253,16 +1255,16 @@ void smv_typecheckt::collect_define(const exprt &expr)
12531255

12541256
const irep_idt &identifier=op0.get(ID_identifier);
12551257

1256-
symbol_tablet::symbolst::iterator it=symbol_table.symbols.find(identifier);
1258+
auto it=symbol_table.get_writeable(identifier);
12571259

1258-
if(it==symbol_table.symbols.end())
1260+
if(it==nullptr)
12591261
{
12601262
error() << "collect_define failed to find symbol `"
12611263
<< identifier << "'" << eom;
12621264
throw 0;
12631265
}
12641266

1265-
symbolt &symbol=it->second;
1267+
symbolt &symbol=*it;
12661268

12671269
symbol.value.make_nil();
12681270
symbol.is_input=false;
@@ -1304,16 +1306,16 @@ void smv_typecheckt::convert_define(const irep_idt &identifier)
13041306
throw 0;
13051307
}
13061308

1307-
symbol_tablet::symbolst::iterator it=symbol_table.symbols.find(identifier);
1309+
auto it=symbol_table.get_writeable(identifier);
13081310

1309-
if(it==symbol_table.symbols.end())
1311+
if(it==nullptr)
13101312
{
13111313
error() << "convert_define failed to find symbol `"
13121314
<< identifier << "'" << eom;
13131315
throw 0;
13141316
}
13151317

1316-
symbolt &symbol=it->second;
1318+
symbolt &symbol=*it;
13171319

13181320
d.in_progress=true;
13191321

src/vhdl/vhdl_synthesis.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void vhdl_synthesist::synth_code(const codet &code)
6161
new_symbol.location.set_comment("assertion "+id2string(constant_expr.get_value()));
6262
}
6363

64-
if(symbol_table.move(new_symbol))
64+
if(symbol_table.add(new_symbol))
6565
{
6666
error() << "failed to add property symbol" << eom;
6767
throw 0;
@@ -140,16 +140,15 @@ bool vhdl_synthesist::operator()()
140140
{
141141
try
142142
{
143-
symbol_tablet::symbolst::iterator s_it=
144-
symbol_table.symbols.find(module);
143+
auto s_it=symbol_table.get_writeable(module);
145144

146-
if(s_it==symbol_table.symbols.end())
145+
if(s_it==nullptr)
147146
{
148147
error() << "module `" << module << "' not found" << eom;
149148
throw 0;
150149
}
151150

152-
symbolt &symbol=s_it->second;
151+
symbolt &symbol=*s_it;
153152
module_symbol=&symbol;
154153

155154
property_counter=0;

0 commit comments

Comments
 (0)