diff --git a/src/goto-programs/goto_functions_template.h b/src/goto-programs/goto_functions_template.h index 679bfc0eebf..b8bc9df0c60 100644 --- a/src/goto-programs/goto_functions_template.h +++ b/src/goto-programs/goto_functions_template.h @@ -16,6 +16,7 @@ Date: June 2003 #include #include +#include #include #include @@ -166,8 +167,18 @@ void goto_functions_templatet::output( const namespacet &ns, std::ostream &out) const { + std::vector sorted_names; + sorted_names.reserve(function_map.size()); for(const auto &fun : function_map) - { + sorted_names.push_back(fun.first); + std::sort( + sorted_names.begin(), + sorted_names.end(), + [](const irep_idt &a, const irep_idt &b) + { return as_string(a) +#include #include @@ -80,10 +81,18 @@ bool symbol_tablet::remove(const irep_idt &name) /// \param out: The ostream to direct output to void symbol_tablet::show(std::ostream &out) const { + std::vector sorted_names; + sorted_names.reserve(symbols.size()); + for(const auto &elem : symbols) + sorted_names.push_back(elem.first); + std::sort( + sorted_names.begin(), + sorted_names.end(), + [](const irep_idt &a, const irep_idt &b) + { return as_string(a)second; + for(const auto &name : sorted_names) + out << symbols.at(name); } /// Print the contents of the symbol table