Skip to content

Commit 043ec72

Browse files
committed
Clean up show_symbol_table
Don't use a std::set for a load-sort-read procedure; don't convert everything to and from std::string.
1 parent 957603c commit 043ec72

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/goto-programs/show_symbol_table.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "show_symbol_table.h"
1313

14+
#include <algorithm>
1415
#include <iostream>
1516
#include <memory>
1617

@@ -68,16 +69,16 @@ void show_symbol_table_plain(
6869
out << '\n' << "Symbols:" << '\n' << '\n';
6970

7071
// we want to sort alphabetically
71-
std::set<std::string> symbols;
72+
std::vector<irep_idt> symbols;
73+
symbols.reserve(symbol_table.symbols.size());
7274

7375
for(const auto &symbol_pair : symbol_table.symbols)
74-
{
75-
symbols.insert(id2string(symbol_pair.first));
76-
}
76+
symbols.push_back(symbol_pair.first);
77+
std::sort(symbols.begin(), symbols.end(), dstring_string_cmp);
7778

7879
const namespacet ns(symbol_table);
7980

80-
for(const std::string &id : symbols)
81+
for(const irep_idt &id : symbols)
8182
{
8283
const symbolt &symbol=ns.lookup(id);
8384

0 commit comments

Comments
 (0)