Skip to content

Commit 7038c0a

Browse files
committed
Macros need to be applied across all functions after linking
1 parent f60c553 commit 7038c0a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/goto-programs/read_goto_binary.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,33 @@ static bool link_functions(
349349
}
350350
}
351351

352+
// apply macros
353+
rename_symbolt macro_application;
354+
355+
forall_symbols(it, dest_symbol_table.symbols)
356+
if(it->second.is_macro)
357+
{
358+
const symbolt &symbol=it->second;
359+
360+
assert(symbol.value.id()==ID_symbol);
361+
const irep_idt &id=to_symbol_expr(symbol.value).get_identifier();
362+
363+
#if 0
364+
if(!base_type_eq(symbol.type, ns.lookup(id).type, ns))
365+
{
366+
std::cerr << symbol << std::endl;
367+
std::cerr << ns.lookup(id) << std::endl;
368+
}
369+
assert(base_type_eq(symbol.type, ns.lookup(id).type, ns));
370+
#endif
371+
372+
macro_application.insert_expr(symbol.name, id);
373+
}
374+
375+
if(!macro_application.expr_map.empty())
376+
Forall_goto_functions(dest_it, dest_functions)
377+
rename_symbols_in_function(dest_it->second, macro_application);
378+
352379
return false;
353380
}
354381

0 commit comments

Comments
 (0)