Skip to content

Commit 89a1132

Browse files
authored
Merge pull request #1559 from NathanJPhillips/bugfix/variable-scope
Fixed scope of moved symbol
2 parents af2d3dd + 2f32aee commit 89a1132

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/util/fresh_symbol.cpp

+5-9
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,15 @@ symbolt &get_fresh_aux_symbol(
3838
const irep_idt &symbol_mode,
3939
symbol_tablet &symbol_table)
4040
{
41-
auxiliary_symbolt new_symbol;
42-
4341
// Loop until find a name that doesn't clash with a non-auxilliary symbol
4442
while(true)
4543
{
46-
// Distinguish local variables with the same name
47-
new_symbol.base_name=
48-
basename_prefix+"$"+std::to_string(++temporary_counter);
49-
if(name_prefix.empty())
50-
new_symbol.name=new_symbol.base_name;
51-
else
44+
auxiliary_symbolt new_symbol(
45+
// Distinguish local variables with the same name
46+
basename_prefix + "$" + std::to_string(++temporary_counter),
47+
type);
48+
if(!name_prefix.empty())
5249
new_symbol.name=name_prefix+"::"+id2string(new_symbol.base_name);
53-
new_symbol.type=type;
5450
new_symbol.location=source_location;
5551
new_symbol.mode=symbol_mode;
5652
std::pair<symbolt &, bool> res=symbol_table.insert(std::move(new_symbol));

0 commit comments

Comments
 (0)