File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -45,23 +45,23 @@ bool symbol_tablet::add(const symbolt &symbol)
45
45
// / location in the symbol table
46
46
bool symbol_tablet::move (symbolt &symbol, symbolt *&new_symbol)
47
47
{
48
- symbolt tmp;
49
-
48
+ // Add an empty symbol to the table or retrieve existing symbol with same name
50
49
std::pair<symbolst::iterator, bool > result=
51
- symbols.insert (std::pair<irep_idt, symbolt>( symbol.name , tmp ));
50
+ symbols.emplace ( symbol.name , symbolt ( ));
52
51
53
52
if (!result.second )
54
53
{
54
+ // Return the address of the symbol that already existed in the table
55
55
new_symbol=&result.first ->second ;
56
56
return true ;
57
57
}
58
58
59
- symbol_base_map.insert (
60
- std::pair<irep_idt, irep_idt>(symbol.base_name , symbol.name ));
61
- symbol_module_map.insert (
62
- std::pair<irep_idt, irep_idt>(symbol.module , symbol.name ));
59
+ symbol_base_map.emplace (symbol.base_name , symbol.name );
60
+ symbol_module_map.emplace (symbol.module , symbol.name );
63
61
62
+ // Move the provided symbol into the symbol table
64
63
result.first ->second .swap (symbol);
64
+ // Return the address of the new symbol in the table
65
65
new_symbol=&result.first ->second ;
66
66
67
67
return false ;
You can’t perform that action at this time.
0 commit comments