exprt remove_virtual_functionst::build_class_identifier( const exprt &src) { // the class identifier is in the root class exprt e=src; while(1) { const typet &type=ns.follow(e.type()); assert(type.id()==ID_struct); const struct_typet &struct_type=to_struct_type(type); const struct_typet::componentst &components=struct_type.components(); assert(!components.empty()); member_exprt member_expr( e, components.front().get_name(), components.front().type()); if(components.front().get_name()=="@class_identifier") { // found it return member_expr; } else { e=member_expr; } } }
void invariant_propagationt::get_objects_rec( const exprt &src, std::list<exprt> &dest) { const typet &t=ns.follow(src.type()); if(t.id()==ID_struct || t.id()==ID_union) { const struct_typet &struct_type=to_struct_type(t); const struct_typet::componentst &c=struct_type.components(); exprt member_expr(ID_member); member_expr.copy_to_operands(src); for(struct_typet::componentst::const_iterator it=c.begin(); it!=c.end(); it++) { member_expr.set(ID_component_name, it->get_string(ID_name)); member_expr.type()=it->type(); // recursive call get_objects_rec(member_expr, dest); } } else if(t.id()==ID_array) { //get_objects_rec(identifier, suffix+"[]", t.subtype(), dest); //we don't track these } else if(check_type(t)) { dest.push_back(src); } }