visit(var.array_size);
}
-void TraversingVisitor::visit(InterfaceBlock &iface)
-{
- if(iface.layout)
- iface.layout->visit(*this);
- if(iface.members)
- iface.members->visit(*this);
-}
-
void TraversingVisitor::visit(FunctionDeclaration &func)
{
enter(func.body);
remove_from_map(stage->types, type.name, type);
}
+void NodeRemover::visit(StructDeclaration &strct)
+{
+ if(to_remove->count(&strct))
+ {
+ remove_from_map<TypeDeclaration>(stage->types, strct.name, strct);
+ if(strct.block_declaration)
+ {
+ string key = format("%s %s", strct.block_declaration->interface, strct.block_name);
+ remove_from_map(stage->interface_blocks, key, *strct.block_declaration);
+ remove_from_map(stage->interface_blocks, strct.block_declaration->name, *strct.block_declaration);
+ strct.block_declaration->block_declaration = 0;
+ }
+ }
+}
+
void NodeRemover::visit(VariableDeclaration &var)
{
- if(recursive_remove || to_remove->count(&var))
+ if(to_remove->count(&var))
{
remove_from_map(current_block->variables, var.name, var);
+ if(var.block_declaration)
+ {
+ remove_from_map(stage->interface_blocks, format("%s %s", var.interface, var.block_declaration->block_name), var);
+ remove_from_map(stage->interface_blocks, var.name, var);
+ var.block_declaration->block_declaration = 0;
+ }
stage->locations.erase(var.name);
if(var.linked_declaration)
var.linked_declaration->linked_declaration = 0;
var.init_expression = 0;
}
-void NodeRemover::visit(InterfaceBlock &iface)
-{
- if(to_remove->count(&iface))
- {
- remove_from_map(stage->interface_blocks, format("%s %s", iface.interface, iface.block_name), iface);
- if(!iface.instance_name.empty())
- remove_from_map(stage->interface_blocks, iface.instance_name, iface);
- }
- SetFlag set_recursive(recursive_remove, recursive_remove || to_remove->count(&iface));
- TraversingVisitor::visit(iface);
-}
-
void NodeRemover::visit(FunctionDeclaration &func)
{
if(to_remove->count(&func))