File tree 2 files changed +24
-4
lines changed
2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Date: June 2003
16
16
17
17
#include < ostream>
18
18
#include < cassert>
19
+ #include < algorithm>
19
20
20
21
#include < util/std_types.h>
21
22
#include < util/symbol.h>
@@ -166,8 +167,18 @@ void goto_functions_templatet<bodyT>::output(
166
167
const namespacet &ns,
167
168
std::ostream &out) const
168
169
{
170
+ std::vector<irep_idt> sorted_names;
171
+ sorted_names.reserve (function_map.size ());
169
172
for (const auto &fun : function_map)
170
- {
173
+ sorted_names.push_back (fun.first );
174
+ std::sort (
175
+ sorted_names.begin (),
176
+ sorted_names.end (),
177
+ [](const irep_idt &a, const irep_idt &b)
178
+ { return as_string (a)<as_string (b); });
179
+ for (const auto &name : sorted_names)
180
+ {
181
+ const auto &fun=*function_map.find (name);
171
182
if (fun.second .body_available ())
172
183
{
173
184
out << " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n " ;
Original file line number Diff line number Diff line change 3
3
#include " symbol_table.h"
4
4
5
5
#include < ostream>
6
+ #include < algorithm>
6
7
#include < util/invariant.h>
7
8
8
9
@@ -80,10 +81,18 @@ bool symbol_tablet::remove(const irep_idt &name)
80
81
// / \param out: The ostream to direct output to
81
82
void symbol_tablet::show (std::ostream &out) const
82
83
{
84
+ std::vector<irep_idt> sorted_names;
85
+ sorted_names.reserve (symbols.size ());
86
+ for (const auto &elem : symbols)
87
+ sorted_names.push_back (elem.first );
88
+ std::sort (
89
+ sorted_names.begin (),
90
+ sorted_names.end (),
91
+ [](const irep_idt &a, const irep_idt &b)
92
+ { return as_string (a)<as_string (b); });
83
93
out << " \n " << " Symbols:" << " \n " ;
84
-
85
- forall_symbols (it, symbols)
86
- out << it->second ;
94
+ for (const auto &name : sorted_names)
95
+ out << symbols.at (name);
87
96
}
88
97
89
98
// / Print the contents of the symbol table
You can’t perform that action at this time.
0 commit comments