@@ -40,15 +40,12 @@ void cpp_typecheckt::typecheck_method_bodies()
4040 continue ;
4141
4242#ifdef DEBUG
43- std::cout << " convert_method_body: " << method_symbol.name << std::endl ;
44- std::cout << " is_not_nil: " << body.is_not_nil () << std::endl ;
45- std::cout << " !is_zero: " << (!body.is_zero ()) << std::endl ;
43+ std::cout << " convert_method_body: " << method_symbol.name << " \n " ;
44+ std::cout << " is_not_nil: " << body.is_not_nil () << " \n " ;
45+ std::cout << " !is_zero: " << (!body.is_zero ()) << " \n " ;
4646#endif
47- if (body.is_not_nil () &&
48- !body.is_zero ())
49- {
47+ if (body.is_not_nil () && !body.is_zero ())
5048 convert_function (method_symbol);
51- }
5249 }
5350
5451 old_instantiation_stack.swap (instantiation_stack);
@@ -57,22 +54,16 @@ void cpp_typecheckt::typecheck_method_bodies()
5754void cpp_typecheckt::add_method_body (symbolt *_method_symbol)
5855{
5956#ifdef DEBUG
60- std::cout << " add_method_body: " << _method_symbol->name << std::endl ;
57+ std::cout << " add_method_body: " << _method_symbol->name << " \n " ;
6158#endif
62-
63- // We have to prevent the same method to be added multiple times
64- // otherwise we get duplicated symbol prefixes
65- if (methods_seen.find (_method_symbol->name ) != methods_seen.end ())
66- {
59+ // Converting a method body might add method bodies for methods that we have
60+ // already analyzed. Adding the same method more than once causes duplicated
61+ // symbol prefixes, therefore we have to keep track.
62+ if (methods_seen.insert (_method_symbol->name ).second )
63+ method_bodies.push_back (method_bodyt (
64+ _method_symbol, template_map, instantiation_stack));
6765#ifdef DEBUG
68- std::cout << " already exists" << std::endl;
66+ else
67+ std::cout << " already exists" << " \n " ;
6968#endif
70- return ;
71- }
72- method_bodies.push_back (method_bodyt (
73- _method_symbol, template_map, instantiation_stack));
74-
75- // Converting a method body might add method bodies for methods
76- // that we have already analyzed. Hence, we have to keep track.
77- methods_seen.insert (_method_symbol->name );
7869}
0 commit comments