Skip to content

Commit 088781f

Browse files
author
Daniel Kroening
committed
show_goto_functions: sort alphabetically
1 parent 3f42b60 commit 088781f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/goto-programs/show_goto_functions.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Author: Peter Schrammel
2525
#include "goto_functions.h"
2626
#include "goto_model.h"
2727

28+
#include <algorithm>
29+
2830
void show_goto_functions(
2931
const namespacet &ns,
3032
message_handlert &message_handler,
@@ -51,9 +53,19 @@ void show_goto_functions(
5153

5254
case ui_message_handlert::uit::PLAIN:
5355
{
56+
// sort alphabetically
57+
std::vector<std::string> function_ids;
58+
function_ids.reserve(goto_functions.function_map.size());
59+
5460
for(const auto &fun : goto_functions.function_map)
61+
function_ids.push_back(id2string(fun.first));
62+
63+
std::sort(function_ids.begin(), function_ids.end());
64+
65+
for(const auto &f_id : function_ids)
5566
{
56-
const symbolt &symbol = ns.lookup(fun.first);
67+
const symbolt &symbol = ns.lookup(f_id);
68+
const auto &fun = *goto_functions.function_map.find(f_id);
5769

5870
if(list_only)
5971
{

0 commit comments

Comments
 (0)